dépôts
/
lhc
/
web
/
wiklou.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge "Show protection log on creation-protected pages"
[lhc/web/wiklou.git]
/
tests
/
phpunit
/
includes
/
WatchedItemQueryServiceUnitTest.php
diff --git
a/tests/phpunit/includes/WatchedItemQueryServiceUnitTest.php
b/tests/phpunit/includes/WatchedItemQueryServiceUnitTest.php
index
bdec0a5
..
958d70a
100644
(file)
--- a/
tests/phpunit/includes/WatchedItemQueryServiceUnitTest.php
+++ b/
tests/phpunit/includes/WatchedItemQueryServiceUnitTest.php
@@
-1,5
+1,7
@@
<?php
<?php
+use Wikimedia\TestingAccessWrapper;
+
/**
* @covers WatchedItemQueryService
*/
/**
* @covers WatchedItemQueryService
*/
@@
-19,9
+21,9
@@
class WatchedItemQueryServiceUnitTest extends PHPUnit_Framework_TestCase {
$this->isType( 'array' ),
$this->isType( 'int' )
)
$this->isType( 'array' ),
$this->isType( 'int' )
)
- ->will( $this->returnCallback( function( $a, $conj ) {
+ ->will( $this->returnCallback( function
( $a, $conj ) {
$sqlConj = $conj === LIST_AND ? ' AND ' : ' OR ';
$sqlConj = $conj === LIST_AND ? ' AND ' : ' OR ';
- return join( $sqlConj, array_map( function( $s ) {
+ return join( $sqlConj, array_map( function
( $s ) {
return '(' . $s . ')';
}, $a
) );
return '(' . $s . ')';
}, $a
) );
@@
-29,7
+31,7
@@
class WatchedItemQueryServiceUnitTest extends PHPUnit_Framework_TestCase {
$mock->expects( $this->any() )
->method( 'addQuotes' )
$mock->expects( $this->any() )
->method( 'addQuotes' )
- ->will( $this->returnCallback( function( $value ) {
+ ->will( $this->returnCallback( function
( $value ) {
return "'$value'";
} ) );
return "'$value'";
} ) );
@@
-39,7
+41,7
@@
class WatchedItemQueryServiceUnitTest extends PHPUnit_Framework_TestCase {
$mock->expects( $this->any() )
->method( 'bitAnd' )
$mock->expects( $this->any() )
->method( 'bitAnd' )
- ->willReturnCallback( function( $a, $b ) {
+ ->willReturnCallback( function
( $a, $b ) {
return "($a & $b)";
} );
return "($a & $b)";
} );
@@
-56,7
+58,7
@@
class WatchedItemQueryServiceUnitTest extends PHPUnit_Framework_TestCase {
->getMock();
$mock->expects( $this->any() )
->method( 'getConnectionRef' )
->getMock();
$mock->expects( $this->any() )
->method( 'getConnectionRef' )
- ->with( DB_
SLAVE
)
+ ->with( DB_
REPLICA
)
->will( $this->returnValue( $mockDb ) );
return $mock;
}
->will( $this->returnValue( $mockDb ) );
return $mock;
}
@@
-66,7
+68,7
@@
class WatchedItemQueryServiceUnitTest extends PHPUnit_Framework_TestCase {
* @return PHPUnit_Framework_MockObject_MockObject|User
*/
private function getMockNonAnonUserWithId( $id ) {
* @return PHPUnit_Framework_MockObject_MockObject|User
*/
private function getMockNonAnonUserWithId( $id ) {
- $mock = $this->getMock
( User::class
);
+ $mock = $this->getMock
Builder( User::class )->getMock(
);
$mock->expects( $this->any() )
->method( 'isAnon' )
->will( $this->returnValue( false ) );
$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' )
$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' )
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 );
} ) );
$actions = func_get_args();
return !in_array( $notAllowedAction, $actions );
} ) );
@@
-142,7
+144,7
@@
class WatchedItemQueryServiceUnitTest extends PHPUnit_Framework_TestCase {
}
private function getMockAnonUser() {
}
private function getMockAnonUser() {
- $mock = $this->getMock
( User::class
);
+ $mock = $this->getMock
Builder( User::class )->getMock(
);
$mock->expects( $this->any() )
->method( 'isAnon' )
->will( $this->returnValue( true ) );
$mock->expects( $this->any() )
->method( 'isAnon' )
->will( $this->returnValue( true ) );
@@
-1448,7
+1450,7
@@
class WatchedItemQueryServiceUnitTest extends PHPUnit_Framework_TestCase {
$mockDb = $this->getMockDb();
$mockDb->expects( $this->any() )
->method( 'addQuotes' )
$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() )
return "'$value'";
} ) );
$mockDb->expects( $this->any() )
@@
-1457,9
+1459,9
@@
class WatchedItemQueryServiceUnitTest extends PHPUnit_Framework_TestCase {
$this->isType( 'array' ),
$this->isType( 'int' )
)
$this->isType( 'array' ),
$this->isType( 'int' )
)
- ->will( $this->returnCallback( function( $a, $conj ) {
+ ->will( $this->returnCallback( function
( $a, $conj ) {
$sqlConj = $conj === LIST_AND ? ' AND ' : ' OR ';
$sqlConj = $conj === LIST_AND ? ' AND ' : ' OR ';
- return join( $sqlConj, array_map( function( $s ) {
+ return join( $sqlConj, array_map( function
( $s ) {
return '(' . $s . ')';
}, $a
) );
return '(' . $s . ')';
}, $a
) );