コード例 #1
0
 public function testAuthenticateSuccess()
 {
     $role = new Role('customer', null);
     $user = new User('*****@*****.**', 'john', 'John', 'Smith', 'password');
     $user->activate();
     $user->addRole($role);
     $identity = $this->authenticator->authenticate(['authenticator' => Authenticator::AUTH_EMAIL, 'user' => $user, 'password' => 'password']);
     $this->assertEquals(new Identity(null, ['customer']), $identity);
 }
コード例 #2
0
ファイル: UserTest.php プロジェクト: janlavicka/devstack
 public function testAuthenticateWithEmail()
 {
     $identity = new Identity(1, ['customer']);
     $this->userStorage->shouldReceive('isAuthenticated')->once()->andReturn(false);
     $this->userStorage->shouldReceive('setIdentity')->once()->with(null);
     $this->authenticator->shouldReceive('authenticateWithEmail')->once()->with('*****@*****.**', 'password')->andReturn($identity);
     $this->userStorage->shouldReceive('setIdentity')->once()->with($identity);
     $this->userStorage->shouldReceive('setAuthenticated')->once()->with(true);
     $this->user->authenticateWithEmail('*****@*****.**', 'password');
 }