function it_throws_exception_if_no_cart_can_be_provided(ChannelInterface $channel, ChannelContextInterface $channelContext, CustomerContextInterface $customerContext, CustomerInterface $customer, OrderRepositoryInterface $orderRepository)
 {
     $channelContext->getChannel()->willReturn($channel);
     $customerContext->getCustomer()->willReturn($customer);
     $orderRepository->findLatestCartByChannelAndCustomer($channel, $customer)->willReturn(null);
     $this->shouldThrow(new CartNotFoundException('Sylius was not able to find the cart for currently logged in user.'))->during('getCart', []);
 }
 /**
  * {@inheritdoc}
  */
 public function getCart()
 {
     try {
         $channel = $this->channelContext->getChannel();
     } catch (ChannelNotFoundException $exception) {
         throw new CartNotFoundException('Sylius was not able to find the cart, as there is no current channel.');
     }
     $customer = $this->customerContext->getCustomer();
     if (null === $customer) {
         throw new CartNotFoundException('Sylius was not able to find the cart, as there is no logged in user.');
     }
     $cart = $this->orderRepository->findLatestCartByChannelAndCustomer($channel, $customer);
     if (null === $cart) {
         throw new CartNotFoundException('Sylius was not able to find the cart for currently logged in user.');
     }
     return $cart;
 }