function it_updates_user_last_login_on_implicit_login(UserEvent $event, UserInterface $user, $userManager)
 {
     $event->getUser()->shouldBeCalled()->willReturn($user);
     $userManager->persist($user)->shouldBeCalled();
     $userManager->flush()->shouldBeCalled();
     $this->onImplicitLogin($event);
 }
 function it_updates_user_last_login_on_implicit_login(ObjectManager $userManager, UserEvent $event, UserInterface $user)
 {
     $event->getUser()->willReturn($user);
     $user->setLastLogin(Argument::type(\DateTime::class))->shouldBeCalled();
     $userManager->persist($user)->shouldBeCalled();
     $userManager->flush()->shouldBeCalled();
     $this->onImplicitLogin($event);
 }
示例#3
0
 /**
  * @param UserEvent $userEvent
  */
 public function onImplicitLogin(UserEvent $userEvent)
 {
     $user = $userEvent->getUser();
     if (!$user instanceof ShopUserInterface) {
         return;
     }
     $this->blame($user);
 }
示例#4
0
 function it_blames_cart_on_user($cartManager, $cartProvider, OrderInterface $cart, UserEvent $userEvent, UserInterface $user, CustomerInterface $customer)
 {
     $cartProvider->getCart()->willReturn($cart);
     $userEvent->getUser()->willReturn($user);
     $user->getCustomer()->willReturn($customer);
     $cart->setCustomer($customer)->shouldBeCalled();
     $cartManager->persist($cart)->shouldBeCalled();
     $cartManager->flush($cart)->shouldBeCalled();
     $this->blame($userEvent);
 }
 /**
  * @param UserEvent $userEvent
  */
 public function blame(UserEvent $userEvent)
 {
     $cart = $this->cartProvider->getCart();
     if (!$cart instanceof OrderInterface) {
         throw new UnexpectedTypeException($cart, 'Sylius\\Component\\Core\\Model\\OrderInterface');
     }
     $customer = $userEvent->getUser()->getCustomer();
     $cart->setCustomer($customer);
     $this->cartManager->persist($cart);
     $this->cartManager->flush($cart);
 }
示例#6
0
 /**
  * @param UserEvent $userEvent
  */
 public function blame(UserEvent $userEvent)
 {
     if (!$this->cartProvider->hasCart()) {
         return;
     }
     $cart = $this->cartProvider->getCart();
     if (!$cart instanceof OrderInterface) {
         throw new UnexpectedTypeException($cart, OrderInterface::class);
     }
     $customer = $userEvent->getUser()->getCustomer();
     $cart->setCustomer($customer);
     $this->cartManager->persist($cart);
     $this->cartManager->flush();
 }
 function it_does_nothing_if_there_is_no_existing_cart_on_implicit_login(CartContextInterface $cartContext, UserEvent $userEvent, ShopUserInterface $user)
 {
     $cartContext->getCart()->willThrow(CartNotFoundException::class);
     $userEvent->getUser()->willReturn($user);
     $this->onImplicitLogin($userEvent);
 }
示例#8
0
 /**
  * @param UserEvent $userEvent
  */
 public function onImplicitLogin(UserEvent $userEvent)
 {
     $this->blame($userEvent->getUser());
 }
 /**
  * @param UserEvent $event
  */
 public function onImplicitLogin(UserEvent $event)
 {
     $this->updateUserLastLogin($event->getUser());
 }
示例#10
0
 function it_does_nothing_if_there_is_no_existing_cart_on_implicit_login(CartProviderInterface $cartProvider, UserEvent $userEvent, UserInterface $user)
 {
     $cartProvider->hasCart()->willReturn(false);
     $userEvent->getUser()->willReturn($user);
     $this->onImplicitLogin($userEvent);
 }