Beispiel #1
0
 function it_loads_base_url_and_sets_a_cookie_if_not_using_kernel_driver_and_driver_is_currently_outside_base_url(Session $minkSession, DriverInterface $driver)
 {
     $minkSession->getDriver()->willReturn($driver);
     $minkSession->getCurrentUrl()->willReturn('http://sylius.org');
     $minkSession->visit('http://localhost:8080/')->shouldBeCalled();
     $minkSession->setCookie('abc', 'def')->shouldBeCalled();
     $this->setCookie('abc', 'def');
 }
Beispiel #2
0
 /**
  * {@inheritdoc}
  */
 public function logIn($email, $providerKey, Session $minkSession)
 {
     $user = $this->userRepository->findOneBy(['username' => $email]);
     if (null === $user) {
         throw new \InvalidArgumentException(sprintf('There is no user with email %s', $email));
     }
     $token = new UsernamePasswordToken($user, $user->getPassword(), $providerKey, $user->getRoles());
     $this->session->set('_security_user', serialize($token));
     $this->session->save();
     $minkSession->setCookie($this->session->getName(), $this->session->getId());
 }
Beispiel #3
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));
 }
 public function testSetCookie()
 {
     $this->driver->expects($this->once())->method('setCookie')->with('name', 'value');
     $this->session->setCookie('name', 'value');
 }
Beispiel #5
0
 public function _setCookie($cookie, $value)
 {
     $this->session->setCookie($cookie, $value);
 }
Beispiel #6
0
 /**
  * {@inheritdoc}
  */
 public function setCookie($name, $value)
 {
     $this->prepareMinkSessionIfNeeded();
     $this->minkSession->setCookie($name, $value);
 }
Beispiel #7
0
 /**
  * @When I change my current channel to :channel
  */
 public function iChangeMyCurrentChannelTo(ChannelInterface $channel)
 {
     $this->prepareSessionIfNeeded();
     $this->minkSession->setCookie('_channel_code', $channel->getCode());
 }