Add missing tests for some edge cases in WatchedItem::getNotificationTimestamp
[lhc/web/wiklou.git] / tests / phpunit / includes / WatchedItemIntegrationTest.php
index 20fcedb..e536205 100644 (file)
@@ -105,7 +105,7 @@ class WatchedItemIntegrationTest extends MediaWikiTestCase {
                        WatchedItem::fromUserTitle( $user, $title )->getNotificationTimestamp()
                );
                $user->mRights = [];
-               $this->assertFalse( WatchedItem::fromUserTitle( $user, $title )->isWatched() );
+               $this->assertFalse( WatchedItem::fromUserTitle( $user, $title )->getNotificationTimestamp() );
        }
 
        public function testRemoveWatch_falseOnNotAllowed() {
@@ -120,4 +120,14 @@ class WatchedItemIntegrationTest extends MediaWikiTestCase {
                $this->assertTrue( WatchedItem::fromUserTitle( $user, $title )->removeWatch() );
        }
 
+       public function testGetNotificationTimestamp_falseOnNotWatched() {
+               $user = $this->getUser();
+               $title = Title::newFromText( 'WatchedItemIntegrationTestPage' );
+
+               WatchedItem::fromUserTitle( $user, $title )->removeWatch();
+               $this->assertFalse( WatchedItem::fromUserTitle( $user, $title )->isWatched() );
+
+               $this->assertFalse( WatchedItem::fromUserTitle( $user, $title )->getNotificationTimestamp() );
+       }
+
 }