/** * @dataProvider providerSetUserChannelset */ public function testSetUserChannelset($loginKey, $channelsetId) { $this->assertEquals(0, sizeof(InstructionControl::listUserForChannelset($channelsetId))); $u = InstructionControl::getUser($loginKey); InstructionControl::setUserChannelset($u['id'], $channelsetId); $this->assertEquals(1, sizeof(InstructionControl::listUserForChannelset($channelsetId))); $v = array_pop(InstructionControl::listUserForChannelset($channelsetId)); $this->assertEquals($u, $v); }
/** * Lists public details about Users registered with a specific channelset. * * Body of output document takes the form: * * <code> * {"user communication key":{"known_as":"Fred Basset"},...} * </code> * * @param array $params Expects one key `channelset` which should be the * name of a channelset. */ public function restGetChannelsetUser($params) { $channelsetId = $this->getChannelSetId($params['channelset']); $allData = InstructionControl::listUserForChannelset($channelsetId); $r = array(); foreach ($allData as $ad) { $r[$ad['communication_key']] = array_diff_key($ad, $this->getProtectedUserPropertyKeys()); } header('HTTP/1.1 200 OK'); echo json_encode(InstructionControl::generateReturnDocument('USER_LIST', array(), array(), array(), array(), $r)); return true; }