public function loadUserByUsername($username)
 {
     $this->session->set('openiduco', 'login');
     if ($this->samlAuth->isAuthenticated()) {
         $user = $this->findUserBySamlId($this->samlAuth->getUsername());
         if (!$user) {
             $this->session->set('openiduco', 'notfound');
             throw new UsernameNotFoundException(sprintf('Username "%s" does not exist.', $username));
         }
         $this->session->set('openiduco', 'found');
         return $user;
     }
     throw new UsernameNotFoundException(sprintf('Username "%s" does not exist.', $username));
 }
 function it_load_user_by_username(SamlAuth $auth, UserInterface $user, UserManagerInterface $userManager)
 {
     $auth->getAttributes()->shouldBeCalled();
     $auth->getUsername()->shouldBeCalled();
     $auth->isAuthenticated()->shouldBeCalled();
     $user->getUsername()->shouldBeCalled();
     $user->getRoles()->shouldBeCalled();
     $userManager->findUserByUsername(self::USERNAME)->shouldBeCalled();
     $samlUser = new SamlUser('*****@*****.**', ['ROLE_USER'], []);
     $this->loadUserByUsername('*****@*****.**')->shouldBeLike($samlUser);
 }