当前位置: 首页>>代码示例>>PHP>>正文


PHP WatchedItem::addWatch方法代码示例

本文整理汇总了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());
 }
开发者ID:paladox,项目名称:mediawiki,代码行数:11,代码来源:WatchedItemUnitTest.php

示例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__);
 }
开发者ID:schwarer2006,项目名称:wikia,代码行数:21,代码来源:WallHooksHelper.class.php


注:本文中的WatchedItem::addWatch方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。