/** * @covers AppBundle\Entity\User::setEnabled * Implement testSetEnabled(). */ public function testSetEnabled() { $this->assertTrue($this->user->getEnabled()); $this->user->setEnabled(true); $this->assertTrue($this->user->getEnabled()); $this->user->setEnabled(false); $this->assertFalse($this->user->getEnabled()); }
public function testEnabled() { $this->assertEmpty($this->user->getEnabled()); $this->user->setEnabled(true); $this->assertEquals(true, $this->user->getEnabled()); }
$this_user = new User(); if ($this_user == null) { header("Location: dashboard.php?message=parameter"); exit(0); } $this_user->setUsername($parms->getParm('username')); $this_user->setFullname($parms->getParm('fullname')); // check password matches if ($parms->getParm('newpassword') != $parms->getParm('repeatpassword')) { // in future should instead recreate form with rest of details readded header("Location: adduser.php?message=passwordmatch"); exit(0); } $this_user->setPassword(md5($parms->getParm('newpassword'))); $this_user->setAccess($parms->getParm('access')); $this_user->setEnabled($parms->getParm('status')); // expiry is a value in secs - no need to convert $this_user->setLoginexpiry($parms->getParm('loginexpiry')); $this_user->setSupervisor($parms->getParm('supervisor')); $this_user->setAdmin($parms->getParm('admin')); // save entry $kdb->insertUser($this_user); include "inc/dashboardheaders.php"; print <<<EOT {$header} {$login_banner} {$main_banner} {$menu_banner} {$main_menu} <h1>New user added</h1>
/** * * @param unknown_type $rs */ private static function _getObject($rs) { $ret = new User(); $ret->setAvatar($rs->getAvatar()); $ret->setCos($rs->getCos()); $ret->setCreationDate($rs->getCreationDate()); $ret->setEmail($rs->getEmail()); $ret->setEnabled($rs->getEnabled()); $ret->setId($rs->getId()); $ret->setName($rs->getName()); $ret->setUsername($rs->getUsername()); // // The following is a workaround on the fact that the translation of this // serialized object to the database gets all broken, due to the fact of PHP // introducing NULL bytes around the '*' that is prepended before protected // variable members, in the serialized mode. This method replaces those // problematic NULL bytes with an identifier string '~~NULL_BYTE~~', // rendering serialization and unserialization of these specific kinds of // object safe. Credits to travis@travishegner.com on: // http://pt.php.net/manual/en/function.serialize.php#96504 // $unsafeSerializedNotifications = str_replace(CINTIENT_NULL_BYTE_TOKEN, "", $rs->getNotifications()); if (($notifications = unserialize($unsafeSerializedNotifications)) === false) { $notifications = array(); } $ret->setNotifications($notifications); $ret->resetSignature(); return $ret; }
public static function createUser() { $timecode = substr(md5(microtime()), 0, 5); $role = new Role('ROLE_USER', null, 'false'); $result = new User(); $result->setUsername('test_' . $timecode); $result->setPassword($timecode); $result->setEmailAddress('test@' . $timecode . '.com'); $result->setFullname('User ' . $timecode); $result->setTenantId('organization_1'); $result->setEnabled('true'); $result->addRole($role); return $result; }