/** * Topic Management constructor * calls parent constructor too. * * @param string $action represents the action to do ('add', 'mod', 'del') * @param int $id topic id * @param int $id_test test id */ public function __construct($action, $id = null, $id_test = null) { parent::__construct($action, $id); if ($_POST && $_POST['id_nodo_parent'] == $id_test) { $this->what = translateFN('sessione'); } else { $this->what = translateFN('argomento'); } $this->id_test = $id_test; }
/** * Management constructor. the $action parameter must be 'add', 'mod' or 'del' * * @global db $dh * * @param string $action * @param int $id node id * @param int $id_test test node id */ public function __construct($action, $id = null, $id_test = null) { $dh = $GLOBALS['dh']; parent::__construct($action, $id); $this->what = translateFN('domanda'); if (is_null($id_test)) { $q = $dh->test_getNode($id); if (AMATestDataHandler::isError($q) || empty($q)) { return; } $id_test = $q['id_nodo_radice']; } $test = $dh->test_getNode($id_test); if (AMATestDataHandler::isError($test) || empty($test)) { return; } $this->test = $test; }
/** * @depends testGetListOfAdministrators */ public function testCreateUserFromAdmin($admins) { $mng = new Management(); $user = $mng->getUser($admins->data[0]->oid); if (isset($user->oid) and $user->oid == $admins->data[0]->oid) { self::$adminUserExists = true; $userObj = $user; } else { $result = $mng->createUserFromAdmin(self::$alias, $admins->data[0]->userId); $this->assertObjectHasAttribute('oid', $result); $this->assertObjectHasAttribute('shortOID', $result); $this->assertObjectHasAttribute('fullName', $result); $this->assertObjectHasAttribute('email', $result); $this->assertObjectHasAttribute('phoneNumber', $result); $this->assertObjectHasAttribute('disabled', $result); $userObj = $mng->getUserByAlias(self::$alias); } return $userObj; }