Beispiel #1
0
 function it_resets_current_cart_identifier_in_storage_when_abandoning_cart(CartContextInterface $cartContext, RepositoryInterface $cartRepository, EventDispatcherInterface $eventDispatcher, CartInterface $cart)
 {
     $cartContext->getCurrentCartIdentifier()->willReturn(123);
     $cartRepository->find(123)->willReturn($cart);
     $cartContext->resetCurrentCartIdentifier()->shouldBeCalled();
     $eventDispatcher->dispatch(SyliusCartEvents::CART_ABANDON, Argument::type(GenericEvent::class))->shouldBeCalled();
     $this->abandonCart();
 }
Beispiel #2
0
 /**
  * {@inheritdoc}
  */
 public function abandonCart()
 {
     if (null !== $this->cart) {
         $this->eventDispatcher->dispatch(SyliusCartEvents::CART_ABANDON, new CartEvent($this->cart));
     }
     $this->cart = null;
     $this->context->resetCurrentCartIdentifier();
 }
Beispiel #3
0
 /**
  * {@inheritdoc}
  */
 public function abandonCart()
 {
     $cart = $this->provideCart();
     $this->eventDispatcher->dispatch(SyliusCartEvents::CART_ABANDON, new GenericEvent($cart));
     $this->cartContext->resetCurrentCartIdentifier();
 }