예제 #1
0
 public function testAddWatch()
 {
     $title = Title::newFromText('SomeTitle');
     $timestamp = null;
     $checkRights = 0;
     /** @var User|PHPUnit_Framework_MockObject_MockObject $user */
     $user = $this->getMock(User::class);
     $user->expects($this->once())->method('addWatch')->with($title, $checkRights);
     $item = new WatchedItem($user, $title, $timestamp, $checkRights);
     $this->assertTrue($item->addWatch());
 }
예제 #2
0
 private function processActionOnWatchlist($user, $followedUserName, $action)
 {
     wfProfileIn(__METHOD__);
     $watchTitle = Title::newFromText($followedUserName, NS_USER);
     if ($watchTitle instanceof Title) {
         $wl = new WatchedItem();
         $wl->mTitle = $watchTitle;
         $wl->id = $user->getId();
         $wl->ns = $watchTitle->getNamespace();
         $wl->ti = $watchTitle->getDBkey();
         if ($action === 'add') {
             $wl->addWatch();
         } elseif ($action === 'remove') {
             $wl->removeWatch();
         }
     } else {
         //just-in-case -- it shouldn't happen but if it does we want to know about it
         Wikia::log(__METHOD__, false, 'WALL_HOOK_ERROR: No title instance while syncing follows. User name: ' . $followedUserName);
     }
     wfProfileOut(__METHOD__);
 }