public function loadUserByOAuthUserResponse(UserResponseInterface $response)
 {
     try {
         $user = $this->fosService->loadUserByUsername($response->getUsername());
     } catch (UsernameNotFoundException $e) {
         $user = $this->createNewUser($response->getUsername(), $response->getEmail(), $response);
     }
     return $user;
 }
Ejemplo n.º 2
0
 /**
  * @expectedException \Symfony\Component\Security\Core\Exception\UsernameNotFoundException
  */
 public function testLoadUserByInvalidUsername()
 {
     $this->userManager->expects($this->once())->method('findUserByUsernameOrEmail')->with('foobar')->will($this->returnValue(null));
     $this->userProvider->loadUserByUsername('foobar');
 }