Merge "IP: Remove unused static member $proxyIpSet"
[lhc/web/wiklou.git] / tests / phpunit / includes / WatchedItemUnitTest.php
index 0182eb7..8897645 100644 (file)
@@ -14,7 +14,7 @@ class WatchedItemUnitTest extends MediaWikiTestCase {
         * @return PHPUnit_Framework_MockObject_MockObject|User
         */
        private function getMockUser( $id ) {
-               $user = $this->getMock( User::class );
+               $user = $this->createMock( User::class );
                $user->expects( $this->any() )
                        ->method( 'getId' )
                        ->will( $this->returnValue( $id ) );
@@ -78,42 +78,13 @@ class WatchedItemUnitTest extends MediaWikiTestCase {
                $this->assertEquals( $timestamp, $item->getNotificationTimestamp() );
        }
 
-       /**
-        * @dataProvider provideUserTitleTimestamp
-        */
-       public function testResetNotificationTimestamp( $user, $linkTarget, $timestamp ) {
-               $force = 'XXX';
-               $oldid = 999;
-
-               $store = $this->getMockWatchedItemStore();
-               $store->expects( $this->once() )
-                       ->method( 'resetNotificationTimestamp' )
-                       ->with( $user, $this->isInstanceOf( Title::class ), $force, $oldid )
-                       ->will( $this->returnCallback(
-                               function ( $user, Title $title, $force, $oldid ) use ( $linkTarget ) {
-                                       /** @var LinkTarget $linkTarget */
-                                       $this->assertInstanceOf( 'Title', $title );
-                                       $this->assertSame( $linkTarget->getDBkey(), $title->getDBkey() );
-                                       $this->assertSame( $linkTarget->getFragment(), $title->getFragment() );
-                                       $this->assertSame( $linkTarget->getNamespace(), $title->getNamespace() );
-                                       $this->assertSame( $linkTarget->getText(), $title->getText() );
-
-                                       return true;
-                               }
-                       ) );
-               $this->setService( 'WatchedItemStore', $store );
-
-               $item = new WatchedItem( $user, $linkTarget, $timestamp );
-               $item->resetNotificationTimestamp( $force, $oldid );
-       }
-
        public function testAddWatch() {
                $title = Title::newFromText( 'SomeTitle' );
                $timestamp = null;
                $checkRights = 0;
 
                /** @var User|PHPUnit_Framework_MockObject_MockObject $user */
-               $user = $this->getMock( User::class );
+               $user = $this->createMock( User::class );
                $user->expects( $this->once() )
                        ->method( 'addWatch' )
                        ->with( $title, $checkRights );
@@ -128,7 +99,7 @@ class WatchedItemUnitTest extends MediaWikiTestCase {
                $checkRights = 0;
 
                /** @var User|PHPUnit_Framework_MockObject_MockObject $user */
-               $user = $this->getMock( User::class );
+               $user = $this->createMock( User::class );
                $user->expects( $this->once() )
                        ->method( 'removeWatch' )
                        ->with( $title, $checkRights );
@@ -153,7 +124,7 @@ class WatchedItemUnitTest extends MediaWikiTestCase {
                $checkRights = 0;
 
                /** @var User|PHPUnit_Framework_MockObject_MockObject $user */
-               $user = $this->getMock( User::class );
+               $user = $this->createMock( User::class );
                $user->expects( $this->once() )
                        ->method( 'isWatched' )
                        ->with( $title, $checkRights )
@@ -176,38 +147,4 @@ class WatchedItemUnitTest extends MediaWikiTestCase {
                WatchedItem::duplicateEntries( $oldTitle, $newTitle );
        }
 
-       public function testBatchAddWatch() {
-               $itemOne = new WatchedItem( $this->getMockUser( 1 ), new TitleValue( 0, 'Title1' ), null );
-               $itemTwo = new WatchedItem(
-                       $this->getMockUser( 3 ),
-                       Title::newFromText( 'Title2' ),
-                       '20150101010101'
-               );
-
-               $store = $this->getMockWatchedItemStore();
-               $store->expects( $this->exactly( 2 ) )
-                       ->method( 'addWatchBatchForUser' );
-               $store->expects( $this->at( 0 ) )
-                       ->method( 'addWatchBatchForUser' )
-                       ->with(
-                               $itemOne->getUser(),
-                               [
-                                       $itemOne->getTitle()->getSubjectPage(),
-                                       $itemOne->getTitle()->getTalkPage(),
-                               ]
-                       );
-               $store->expects( $this->at( 1 ) )
-                       ->method( 'addWatchBatchForUser' )
-                       ->with(
-                               $itemTwo->getUser(),
-                               [
-                                       $itemTwo->getTitle()->getSubjectPage(),
-                                       $itemTwo->getTitle()->getTalkPage(),
-                               ]
-                       );
-               $this->setService( 'WatchedItemStore', $store );
-
-               WatchedItem::batchAddWatch( [ $itemOne, $itemTwo ] );
-       }
-
 }