Exemplo n.º 1
0
 function it_does_not_log_user_in_if_user_was_not_found($userRepository, $session, UserInterface $user, Session $minkSession)
 {
     $userRoles = ['ROLE_USER'];
     $userRepository->findOneBy(array('username' => '*****@*****.**'))->willReturn(null);
     $user->getRoles()->willReturn($userRoles);
     $user->getPassword()->willReturn('xyz');
     $user->serialize()->willReturn('serialized_user');
     $session->set('_security_user', Argument::any())->shouldNotBeCalled();
     $session->save()->shouldNotBeCalled();
     $session->getName()->willReturn('MOCKEDSID');
     $session->getId()->willReturn('xyzc123');
     $minkSession->setCookie('MOCKEDSID', 'xyzc123')->shouldNotBeCalled();
     $this->shouldThrow(new \InvalidArgumentException(sprintf('There is no user with email sylius@example.com')))->during('logIn', array('*****@*****.**', 'default', $minkSession));
 }