/** * Tests GroupId->getGroupId() */ public function testGetGroupId() { $this->assertEquals(1, $this->GroupId->getGroupId()); }
/** * Returns a list of people that correspond to the passed in person ids. * * @throws SocialSpiException * @param array $userId Ids of the people to fetch. * @param GroupId $groupId Id of the group * @param CollectionOptions $options Request options for filtering/sorting/paging * @param array $fields Set of contact fields to return, as array('fieldName' => 'fieldName') * If $fields['all'] is set, all fields are returned. * @param SecurityToken $token OAuth Security Token * @return EmptyResponseItem|RestfulCollection */ function getPeople($userId, $groupId, CollectionOptions $options, $fields, SecurityToken $token) { if (isset($fields["all"])) { $fields = array(); // clear the default fields } if ($groupId->getGroupId() === 'self') { $fields = array_values($fields); $people = array(); $socialData = $this->_getSocialData(); foreach ($userId as $userId) { $person = $socialData->getPerson($userId, $fields, isset($_REQUEST['vo']) ? $_REQUEST['vo'] : null, isset($_REQUEST['sp-entity-id']) ? $_REQUEST['sp-entity-id'] : null); if (!empty($person)) { $people[] = $person; } } if (empty($people)) { return new EngineBlock_Shindig_Response_EmptyResponseItem(); } } else { if ($groupId->getType() === 'all') { throw new SocialSpiException("Not implemented by EngineBlock", ResponseError::$INTERNAL_ERROR); } else { if (count($userId) > 1) { $message = "Getting the group members for a group given *multiple* uids is not implemented" . " by EngineBlock (try picking one uid)"; throw new SocialSpiException($message, ResponseError::$INTERNAL_ERROR); } $groupMemberUid = array_shift($userId); /** @var $groupMemberUid UserId */ $groupMemberUid = $groupMemberUid->getUserId($token); $groupId = $groupId->getGroupId(); $groupId = array_shift($groupId); $people = $this->_getSocialData()->getGroupMembers($groupMemberUid, $groupId, $fields, isset($_REQUEST['vo']) ? $_REQUEST['vo'] : null, isset($_REQUEST['sp-entity-id']) ? $_REQUEST['sp-entity-id'] : null); } } $totalSize = count($people); $collection = new RestfulCollection($people, $options->getStartIndex(), $totalSize); $collection->setItemsPerPage($options->getCount()); return $collection; }