Merge "Add WatchedItemStore::getWatchedItemsForUser"
[lhc/web/wiklou.git] / tests / phpunit / includes / WatchedItemStoreIntegrationTest.php
index 9eaa35a..5b2873a 100644 (file)
@@ -67,6 +67,10 @@ class WatchedItemStoreIntegrationTest extends MediaWikiTestCase {
                        [ 0 => [ 'WatchedItemStoreIntegrationTestPage' => 0 ] ],
                        $store->countWatchersMultiple( [ $title ], [ 'minimumWatchers' => $initialWatchers + 2 ] )
                );
+               $this->assertEquals(
+                       [ $title->getNamespace() => [ $title->getDBkey() => null ] ],
+                       $store->getNotificationTimestampsBatch( $user, [ $title ] )
+               );
 
                $store->removeWatch( $user, $title );
                $this->assertFalse(
@@ -94,6 +98,10 @@ class WatchedItemStoreIntegrationTest extends MediaWikiTestCase {
                        $initialWatchers,
                        $store->countWatchersMultiple( [ $title ] )[$title->getNamespace()][$title->getDBkey()]
                );
+               $this->assertEquals(
+                       [ $title->getNamespace() => [ $title->getDBkey() => false ] ],
+                       $store->getNotificationTimestampsBatch( $user, [ $title ] )
+               );
        }
 
        public function testUpdateAndResetNotificationTimestamp() {
@@ -111,10 +119,20 @@ class WatchedItemStoreIntegrationTest extends MediaWikiTestCase {
                        '20150202010101',
                        $store->loadWatchedItem( $user, $title )->getNotificationTimestamp()
                );
+               $this->assertEquals(
+                       [ $title->getNamespace() => [ $title->getDBkey() => '20150202010101' ] ],
+                       $store->getNotificationTimestampsBatch( $user, [ $title ] )
+               );
                $this->assertEquals(
                        $initialVisitingWatchers - 1,
                        $store->countVisitingWatchers( $title, '20150202020202' )
                );
+               $this->assertEquals(
+                       $initialVisitingWatchers - 1,
+                       $store->countVisitingWatchersMultiple(
+                               [ [ $title, '20150202020202' ] ]
+                       )[$title->getNamespace()][$title->getDBkey()]
+               );
                $this->assertEquals(
                        $initialUnreadNotifications + 1,
                        $store->countUnreadNotifications( $user )
@@ -126,10 +144,32 @@ class WatchedItemStoreIntegrationTest extends MediaWikiTestCase {
 
                $this->assertTrue( $store->resetNotificationTimestamp( $user, $title ) );
                $this->assertNull( $store->getWatchedItem( $user, $title )->getNotificationTimestamp() );
+               $this->assertEquals(
+                       [ $title->getNamespace() => [ $title->getDBkey() => null ] ],
+                       $store->getNotificationTimestampsBatch( $user, [ $title ] )
+               );
                $this->assertEquals(
                        $initialVisitingWatchers,
                        $store->countVisitingWatchers( $title, '20150202020202' )
                );
+               $this->assertEquals(
+                       $initialVisitingWatchers,
+                       $store->countVisitingWatchersMultiple(
+                               [ [ $title, '20150202020202' ] ]
+                       )[$title->getNamespace()][$title->getDBkey()]
+               );
+               $this->assertEquals(
+                       [ 0 => [ 'WatchedItemStoreIntegrationTestPage' => $initialVisitingWatchers ] ],
+                       $store->countVisitingWatchersMultiple(
+                               [ [ $title, '20150202020202' ] ], $initialVisitingWatchers
+                       )
+               );
+               $this->assertEquals(
+                       [ 0 => [ 'WatchedItemStoreIntegrationTestPage' => 0 ] ],
+                       $store->countVisitingWatchersMultiple(
+                               [ [ $title, '20150202020202' ] ], $initialVisitingWatchers + 1
+                       )
+               );
        }
 
        public function testDuplicateAllAssociatedEntries() {