本文整理匯總了PHP中Model\User::getByUsername方法的典型用法代碼示例。如果您正苦於以下問題:PHP User::getByUsername方法的具體用法?PHP User::getByUsername怎麽用?PHP User::getByUsername使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Model\User
的用法示例。
在下文中一共展示了User::getByUsername方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: testGetByUsername
public function testGetByUsername()
{
$u = new User($this->container);
$this->assertNotFalse($u->create(array('username' => 'user1')));
$this->assertNotEmpty($u->getByUsername('user1'));
$this->assertEmpty($u->getByUsername('user2'));
$this->assertEmpty($u->getByUsername(''));
}
示例2: testSuccessfulAuthentication
public function testSuccessfulAuthentication()
{
$_SERVER[REVERSE_PROXY_USER_HEADER] = 'my_user';
$a = new ReverseProxy($this->container);
$u = new User($this->container);
$this->assertTrue($a->authenticate());
$user = $u->getByUsername('my_user');
$this->assertNotEmpty($user);
$this->assertEquals(0, $user['is_admin']);
$this->assertEquals(1, $user['is_ldap_user']);
$this->assertEquals(1, $user['disable_login_form']);
}