X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=tests%2Fphpunit%2Fincludes%2FWatchedItemQueryServiceUnitTest.php;h=6b436a8d6de13545e7c43dffeabac2c171552139;hb=be42e09aa866d7def54ead06c91d5dc9c8210ce5;hp=93687df2d5bf752d58896ca03c5dda0e24358a7b;hpb=444f5838afc627eccb102d3d229fe928998a3d9f;p=lhc%2Fweb%2Fwiklou.git diff --git a/tests/phpunit/includes/WatchedItemQueryServiceUnitTest.php b/tests/phpunit/includes/WatchedItemQueryServiceUnitTest.php index 93687df2d5..6b436a8d6d 100644 --- a/tests/phpunit/includes/WatchedItemQueryServiceUnitTest.php +++ b/tests/phpunit/includes/WatchedItemQueryServiceUnitTest.php @@ -1,5 +1,7 @@ isType( 'array' ), $this->isType( 'int' ) ) - ->will( $this->returnCallback( function( $a, $conj ) { + ->will( $this->returnCallback( function ( $a, $conj ) { $sqlConj = $conj === LIST_AND ? ' AND ' : ' OR '; - return join( $sqlConj, array_map( function( $s ) { + return join( $sqlConj, array_map( function ( $s ) { return '(' . $s . ')'; }, $a ) ); @@ -29,7 +31,7 @@ class WatchedItemQueryServiceUnitTest extends PHPUnit_Framework_TestCase { $mock->expects( $this->any() ) ->method( 'addQuotes' ) - ->will( $this->returnCallback( function( $value ) { + ->will( $this->returnCallback( function ( $value ) { return "'$value'"; } ) ); @@ -39,7 +41,7 @@ class WatchedItemQueryServiceUnitTest extends PHPUnit_Framework_TestCase { $mock->expects( $this->any() ) ->method( 'bitAnd' ) - ->willReturnCallback( function( $a, $b ) { + ->willReturnCallback( function ( $a, $b ) { return "($a & $b)"; } ); @@ -66,7 +68,7 @@ class WatchedItemQueryServiceUnitTest extends PHPUnit_Framework_TestCase { * @return PHPUnit_Framework_MockObject_MockObject|User */ private function getMockNonAnonUserWithId( $id ) { - $mock = $this->getMock( User::class ); + $mock = $this->getMockBuilder( User::class )->getMock(); $mock->expects( $this->any() ) ->method( 'isAnon' ) ->will( $this->returnValue( false ) ); @@ -104,12 +106,12 @@ class WatchedItemQueryServiceUnitTest extends PHPUnit_Framework_TestCase { $mock->expects( $this->any() ) ->method( 'isAllowed' ) - ->will( $this->returnCallback( function( $action ) use ( $notAllowedAction ) { + ->will( $this->returnCallback( function ( $action ) use ( $notAllowedAction ) { return $action !== $notAllowedAction; } ) ); $mock->expects( $this->any() ) ->method( 'isAllowedAny' ) - ->will( $this->returnCallback( function() use ( $notAllowedAction ) { + ->will( $this->returnCallback( function () use ( $notAllowedAction ) { $actions = func_get_args(); return !in_array( $notAllowedAction, $actions ); } ) ); @@ -142,7 +144,7 @@ class WatchedItemQueryServiceUnitTest extends PHPUnit_Framework_TestCase { } private function getMockAnonUser() { - $mock = $this->getMock( User::class ); + $mock = $this->getMockBuilder( User::class )->getMock(); $mock->expects( $this->any() ) ->method( 'isAnon' ) ->will( $this->returnValue( true ) ); @@ -1233,7 +1235,7 @@ class WatchedItemQueryServiceUnitTest extends PHPUnit_Framework_TestCase { ->with( 'watchlisttoken' ) ->willReturn( '0123456789abcdef' ); - $this->setExpectedException( UsageException::class, 'Incorrect watchlist token provided' ); + $this->setExpectedException( ApiUsageException::class, 'Incorrect watchlist token provided' ); $queryService->getWatchedItemsWithRecentChangeInfo( $user, [ 'watchlistOwner' => $otherUser, 'watchlistOwnerToken' => $token ] @@ -1448,7 +1450,7 @@ class WatchedItemQueryServiceUnitTest extends PHPUnit_Framework_TestCase { $mockDb = $this->getMockDb(); $mockDb->expects( $this->any() ) ->method( 'addQuotes' ) - ->will( $this->returnCallback( function( $value ) { + ->will( $this->returnCallback( function ( $value ) { return "'$value'"; } ) ); $mockDb->expects( $this->any() ) @@ -1457,9 +1459,9 @@ class WatchedItemQueryServiceUnitTest extends PHPUnit_Framework_TestCase { $this->isType( 'array' ), $this->isType( 'int' ) ) - ->will( $this->returnCallback( function( $a, $conj ) { + ->will( $this->returnCallback( function ( $a, $conj ) { $sqlConj = $conj === LIST_AND ? ' AND ' : ' OR '; - return join( $sqlConj, array_map( function( $s ) { + return join( $sqlConj, array_map( function ( $s ) { return '(' . $s . ')'; }, $a ) );