public function testUserAccountWithRole() { $roles = array("badboys", "jailbreakers"); $adm = new couchAdmin($this->aclient); $ok = $adm->createUser("jack", "dalton", $roles); $this->assertType("object", $ok); $this->assertObjectHasAttribute("ok", $ok); $this->assertEquals($ok->ok, true); $user = $adm->getUser("jack"); $this->assertType("object", $user); $this->assertObjectHasAttribute("_id", $user); $this->assertObjectHasAttribute("roles", $user); $this->assertType("array", $user->roles); $this->assertEquals(count($user->roles), 2); foreach ($user->roles as $role) { $this->assertEquals(in_array($role, $roles), true); } }
$sql.= " GROUP BY s.rowid"; } $sql.= $sOrder; $sql.= $sLimit; $result = $db->query($sql); //print $sql; $couchAdmin = new couchAdmin($couchdb); $i=0; while ($aRow = $db->fetch_object($result)) { //print_r($aRow);exit; $couchAdmin->createUser($aRow->login, $aRow->pass); $col[$aRow->rowid] = $couchAdmin->getUser($aRow->login); $col[$aRow->rowid]->tms = $db->jdate($aRow->tms); $col[$aRow->rowid]->Lastname = $aRow->name; $col[$aRow->rowid]->Firstname = $aRow->firstname; $col[$aRow->rowid]->Administrator = (bool)$aRow->admin; $col[$aRow->rowid]->PhonePro = $aRow->office_phone; $col[$aRow->rowid]->Fax = $aRow->office_fax; $col[$aRow->rowid]->PhoneMobile = $aRow->user_mobile; $col[$aRow->rowid]->EMail = $aRow->email; $col[$aRow->rowid]->Signature = $aRow->signature; $col[$aRow->rowid]->Status = (bool)$aRow->statut; $col[$aRow->rowid]->Photo = $aRow->photo; $col[$aRow->rowid]->Lang = $aRow->lang; $col[$aRow->rowid]->rowid =(int)$aRow->rowid;