Merge "Remove uses of deprecated TestUser properties"
[lhc/web/wiklou.git] / tests / phpunit / includes / WatchedItemIntegrationTest.php
index 20fcedb..be22260 100644 (file)
@@ -13,6 +13,14 @@ class WatchedItemIntegrationTest extends MediaWikiTestCase {
                parent::setUp();
                self::$users['WatchedItemIntegrationTestUser']
                        = new TestUser( 'WatchedItemIntegrationTestUser' );
+
+               $this->hideDeprecated( 'WatchedItem::fromUserTitle' );
+               $this->hideDeprecated( 'WatchedItem::addWatch' );
+               $this->hideDeprecated( 'WatchedItem::removeWatch' );
+               $this->hideDeprecated( 'WatchedItem::isWatched' );
+               $this->hideDeprecated( 'WatchedItem::resetNotificationTimestamp' );
+               $this->hideDeprecated( 'WatchedItem::duplicateEntries' );
+               $this->hideDeprecated( 'WatchedItem::batchAddWatch' );
        }
 
        private function getUser() {
@@ -20,6 +28,7 @@ class WatchedItemIntegrationTest extends MediaWikiTestCase {
        }
 
        public function testWatchAndUnWatchItem() {
+
                $user = $this->getUser();
                $title = Title::newFromText( 'WatchedItemIntegrationTestPage' );
                // Cleanup after previous tests
@@ -105,7 +114,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 +129,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() );
+       }
+
 }