コード例 #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_can_be_instantiated_from_a_culturefeed_user()
 {
     $cfUser = new \CultureFeed_User();
     $properties = ['id' => 1, 'nick' => 'foo', 'mbox' => '*****@*****.**', 'city' => 'Leuven', 'country' => 'Belgium'];
     foreach ($properties as $property => $value) {
         $cfUser->{$property} = $value;
     }
     $user = User::fromCultureFeedUser($cfUser);
     foreach ($properties as $property => $value) {
         $this->assertEquals($value, $user->{$property});
     }
 }
コード例 #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);
 }