Add missing tests for some edge cases in WatchedItem::getNotificationTimestamp
authorLeszek Manicki <leszek.manicki@wikimedia.de>
Wed, 20 Apr 2016 09:57:02 +0000 (11:57 +0200)
committerLeszek Manicki <leszek.manicki@wikimedia.de>
Thu, 21 Apr 2016 13:56:45 +0000 (15:56 +0200)
Change-Id: I18dd5976cc0f44f9dca8ee420ace226e49ab6288

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() );
+       }
+
 }