コード例 #1
0
ファイル: Follower.php プロジェクト: hamaco/phwittr-on-xoops
 /**
  * @test
  */
 public function getFriends()
 {
     $user2 = $this->getUser("test2");
     $friends = Follower::getFriends($user2->id, 100);
     $this->eq(2, count($friends));
     $this->eq("test1", $friends[0]->User->user_name);
     $this->eq("test3", $friends[1]->User->user_name);
 }
コード例 #2
0
ファイル: Submenu.php プロジェクト: hamaco/phwittr-on-xoops
 protected function getUserData()
 {
     $userId = $this->userId;
     $cache = UserCache::getInstance();
     $data = $cache->read($userId);
     if ((ENVIRONMENT & PRODUCTION) > 0 && !$data) {
         list($fp) = $cache->lock($userId);
         $data = $this->_getUserData($userId);
         $cache->write($fp, $data);
     }
     if (!$data) {
         $data = $this->_getUserData($userId);
     }
     return Sabel_ValueObject::fromArray(array("userId" => $userId, "friends" => Follower::getFriends($userId, FRIENDS_ICON_LIMIT + 1), "friendsCount" => $data["friends"], "followersCount" => $data["followers"], "statusesCount" => $data["statuses"], "latestComment" => $data["comment"]));
 }