diff options
author | Thiemo Kreuz <thiemo.kreuz@wikimedia.de> | 2021-04-22 10:28:11 +0200 |
---|---|---|
committer | Thiemo Kreuz <thiemo.kreuz@wikimedia.de> | 2021-04-22 10:37:45 +0200 |
commit | 40764d277c72326271395e8413e75a491b1a68a7 (patch) | |
tree | 2bba35a939c9781817e8b7c005129d3574e83b4e /tests/phpunit/includes/api/ApiOpenSearchTest.php | |
parent | 74653506a88de1bdadbc927b201f9ac6967fab5f (diff) | |
download | mediawikicore-40764d277c72326271395e8413e75a491b1a68a7.tar.gz mediawikicore-40764d277c72326271395e8413e75a491b1a68a7.zip |
Replace PHPUnit ->returnValue() with ->willReturn() shortcut
It's the same and makes the test code much more readable, I
would like to argue.
Because of the was I split all the changes I made into smaller
patches this patch contains some other changes in the same
lines where I could not split them off. E.g. removal of
->any(), which is the default anyway and doesn't do anything.
Change-Id: Ib297b989d4aec33b31a4e33fe9d5032865b39be0
Diffstat (limited to 'tests/phpunit/includes/api/ApiOpenSearchTest.php')
-rw-r--r-- | tests/phpunit/includes/api/ApiOpenSearchTest.php | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/tests/phpunit/includes/api/ApiOpenSearchTest.php b/tests/phpunit/includes/api/ApiOpenSearchTest.php index 3cb41a2c05c7..68df7afeb393 100644 --- a/tests/phpunit/includes/api/ApiOpenSearchTest.php +++ b/tests/phpunit/includes/api/ApiOpenSearchTest.php @@ -6,9 +6,8 @@ class ApiOpenSearchTest extends MediaWikiIntegrationTestCase { public function testGetAllowedParams() { $config = $this->replaceSearchEngineConfig(); - $config->expects( $this->any() ) - ->method( 'getSearchTypes' ) - ->will( $this->returnValue( [ 'the one ring' ] ) ); + $config->method( 'getSearchTypes' ) + ->willReturn( [ 'the one ring' ] ); $api = $this->createApi(); $engine = $this->replaceSearchEngine(); @@ -51,9 +50,8 @@ class ApiOpenSearchTest extends MediaWikiIntegrationTestCase { $engineFactory = $this->getMockBuilder( SearchEngineFactory::class ) ->disableOriginalConstructor() ->getMock(); - $engineFactory->expects( $this->any() ) - ->method( 'create' ) - ->will( $this->returnValue( $engine ) ); + $engineFactory->method( 'create' ) + ->willReturn( $engine ); $this->setService( 'SearchEngineFactory', $engineFactory ); return $engine; |