Example #1
0
 /**
  * Duplicate an existing Cart. If a customer ID is provided the created cart will be attached to this customer.
  *
  * @param EventDispatcherInterface $dispatcher
  * @param CartModel $cart
  * @param CustomerModel $customer
  * @return CartModel
  */
 protected function duplicateCart(EventDispatcherInterface $dispatcher, CartModel $cart, CustomerModel $customer = null)
 {
     $newCart = $cart->duplicate($this->generateCartCookieIdentifier(), $customer, $this->session->getCurrency(), $dispatcher);
     $cartEvent = new CartEvent($newCart);
     $dispatcher->dispatch(TheliaEvents::CART_DUPLICATE, $cartEvent);
     return $cartEvent->getCart();
 }
Example #2
0
 public function testGetCurrency()
 {
     $session = new Session(new MockArraySessionStorage());
     $this->assertInstanceOf('Thelia\\Model\\Currency', $session->getCurrency());
 }