コード例 #1
0
 /**
  * @test
  */
 public function it_can_authenticate_a_uitid_token()
 {
     $this->userService->expects($this->once())->method('getUser')->with('1')->willReturn($this->user);
     $authenticated = $this->authenticator->authenticate($this->unauthenticatedToken);
     $expected = new UiTIDToken($this->user->getRoles());
     $expected->setUser($this->user);
     $this->assertEquals($expected, $authenticated);
 }
コード例 #2
0
 /**
  * @test
  */
 public function it_implements_symfony_user_interface()
 {
     $user = new User();
     $user->nick = 'Foo';
     // Does nothing, but is a required method of UserInterface.
     $user->eraseCredentials();
     $this->assertEmpty($user->getPassword());
     $this->assertNull($user->getSalt());
     $this->assertEquals($user->nick, $user->getUsername());
     $this->assertContains('UITID_USER', $user->getRoles());
 }
コード例 #3
0
 /**
  * @test
  */
 public function it_grants_access_when_authenticated()
 {
     $this->userSessionService->setMinimalUserInfo($this->minimalUserInfo);
     $user = new User();
     $user->id = $this->minimalUserInfo->getId();
     $authToken = new UiTIDToken($user->getRoles());
     $authToken->setUser($user);
     $this->authenticationManager->expects($this->once())->method('authenticate')->with($this->minimalToken)->willReturn($authToken);
     $this->tokenStorage->expects($this->once())->method('setToken')->with($authToken);
     // Make sure no Response is set, so the request can be handled by the
     // actual controllers.
     $this->event->expects($this->never())->method('setResponse');
     $this->listener->handle($this->event);
 }