X-Git-Url: http://git.heureux-cyclage.org/?a=blobdiff_plain;f=tests%2Fphpunit%2Fincludes%2FWatchedItemStoreUnitTest.php;h=0bd0bccbf4909e184b39fc9c660cb7ea5f7b1c0b;hb=24dc5218b18bfa065a101057523f39a9c046d046;hp=ba4705970c7702ab45af931b868eb7c3335d3406;hpb=b2cec6c5928e8e1b417c0855ce8e5560e2e089e1;p=lhc%2Fweb%2Fwiklou.git diff --git a/tests/phpunit/includes/WatchedItemStoreUnitTest.php b/tests/phpunit/includes/WatchedItemStoreUnitTest.php index ba4705970c..0bd0bccbf4 100644 --- a/tests/phpunit/includes/WatchedItemStoreUnitTest.php +++ b/tests/phpunit/includes/WatchedItemStoreUnitTest.php @@ -2404,6 +2404,35 @@ class WatchedItemStoreUnitTest extends MediaWikiTestCase { ); } + public function testSetNotificationTimestampsForUser_nullTimestamp() { + $user = $this->getMockNonAnonUserWithId( 1 ); + $timestamp = null; + + $mockDb = $this->getMockDb(); + $mockDb->expects( $this->once() ) + ->method( 'update' ) + ->with( + 'watchlist', + [ 'wl_notificationtimestamp' => null ], + [ 'wl_user' => 1 ] + ) + ->will( $this->returnValue( true ) ); + $mockDb->expects( $this->exactly( 0 ) ) + ->method( 'timestamp' ) + ->will( $this->returnCallback( function( $value ) { + return 'TS' . $value . 'TS'; + } ) ); + + $store = $this->newWatchedItemStore( + $this->getMockLoadBalancer( $mockDb ), + $this->getMockCache() + ); + + $this->assertTrue( + $store->setNotificationTimestampsForUser( $user, $timestamp ) + ); + } + public function testSetNotificationTimestampsForUser_specificTargets() { $user = $this->getMockNonAnonUserWithId( 1 ); $timestamp = '20100101010101';