本文整理汇总了PHP中WatchedItem::addWatch方法的典型用法代码示例。如果您正苦于以下问题:PHP WatchedItem::addWatch方法的具体用法?PHP WatchedItem::addWatch怎么用?PHP WatchedItem::addWatch使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类WatchedItem
的用法示例。
在下文中一共展示了WatchedItem::addWatch方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testAddWatch
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: processActionOnWatchlist
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__);
}