diff options
author | Daimona Eaytoy <daimona.wiki@gmail.com> | 2021-03-20 16:18:58 +0100 |
---|---|---|
committer | Daimona Eaytoy <daimona.wiki@gmail.com> | 2021-04-16 20:15:00 +0200 |
commit | 535d7abf592d671c22bfb8ba17c35ae1ff74c0a5 (patch) | |
tree | 628ec543a5c64121cdaad15a8b51a3705355e1b7 /tests/phpunit/includes/resourceloader/ResourceLoaderModuleTest.php | |
parent | 592bb57b31b89a3863671da2f26df4f95011ba7c (diff) | |
download | mediawikicore-535d7abf592d671c22bfb8ba17c35ae1ff74c0a5.tar.gz mediawikicore-535d7abf592d671c22bfb8ba17c35ae1ff74c0a5.zip |
phpunit: Mass-replace setMethods with onlyMethods and adjust
Ended up using
grep -Prl '\->setMethods\(' . | xargs sed -r -i 's/setMethods\(/onlyMethods\(/g'
special-casing setMethods( null ) -> onlyMethods( [] )
and then manual fix of failing test (from PS2 onwards).
Bug: T278010
Change-Id: I012dca7ae774bb430c1c44d50991ba0b633353f1
Diffstat (limited to 'tests/phpunit/includes/resourceloader/ResourceLoaderModuleTest.php')
-rw-r--r-- | tests/phpunit/includes/resourceloader/ResourceLoaderModuleTest.php | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/tests/phpunit/includes/resourceloader/ResourceLoaderModuleTest.php b/tests/phpunit/includes/resourceloader/ResourceLoaderModuleTest.php index 0915f40b8dff..b476db23ff1c 100644 --- a/tests/phpunit/includes/resourceloader/ResourceLoaderModuleTest.php +++ b/tests/phpunit/includes/resourceloader/ResourceLoaderModuleTest.php @@ -70,7 +70,7 @@ class ResourceLoaderModuleTest extends ResourceLoaderTestCase { public function testGetVersionHash_parentDefinition() { $context = $this->getResourceLoaderContext(); $module = $this->getMockBuilder( ResourceLoaderModule::class ) - ->setMethods( [ 'getDefinitionSummary' ] )->getMock(); + ->onlyMethods( [ 'getDefinitionSummary' ] )->getMock(); $module->method( 'getDefinitionSummary' )->willReturn( [ 'a' => 'summary' ] ); $this->expectException( LogicException::class ); @@ -207,7 +207,7 @@ class ResourceLoaderModuleTest extends ResourceLoaderTestCase { $this->assertSame( [], $module->getHeaders( $context ), 'Default' ); $module = $this->getMockBuilder( ResourceLoaderTestModule::class ) - ->setMethods( [ 'getPreloadLinks' ] )->getMock(); + ->onlyMethods( [ 'getPreloadLinks' ] )->getMock(); $module->method( 'getPreloadLinks' )->willReturn( [ 'https://example.org/script.js' => [ 'as' => 'script' ], ] ); @@ -220,7 +220,7 @@ class ResourceLoaderModuleTest extends ResourceLoaderTestCase { ); $module = $this->getMockBuilder( ResourceLoaderTestModule::class ) - ->setMethods( [ 'getPreloadLinks' ] )->getMock(); + ->onlyMethods( [ 'getPreloadLinks' ] )->getMock(); $module->method( 'getPreloadLinks' )->willReturn( [ 'https://example.org/script.js' => [ 'as' => 'script' ], '/example.png' => [ 'as' => 'image' ], |