public function testGetAllOptionValuesByIds()
 {
     $originalOptionProduct = $this->setupOptionProduct();
     $this->setCountLogger();
     $optionProducts = $this->optionProductRepository->getAllOptionProductsByIds([$originalOptionProduct->getId()]);
     $optionProducts[0]->getProduct()->getCreated();
     $optionProducts[0]->getOption()->getCreated();
     $this->assertEquals($originalOptionProduct->getid(), $optionProducts[0]->getId());
     $this->assertSame(1, $this->getTotalQueries());
 }
 /**
  * @param UuidInterface $cartItemId
  * @param UuidInterface[] $optionProductIds
  * @throws EntityNotFoundException
  */
 public function addItemOptionProducts(UuidInterface $cartItemId, array $optionProductIds)
 {
     $optionProducts = $this->optionProductRepository->getAllOptionProductsByIds($optionProductIds);
     $cartItem = $this->cartRepository->getItemById($cartItemId);
     $cart = $cartItem->getCart();
     foreach ($optionProducts as $optionProduct) {
         $cartItemOptionProduct = new CartItemOptionProduct();
         $cartItemOptionProduct->setOptionProduct($optionProduct);
         $cartItem->addCartItemOptionProduct($cartItemOptionProduct);
     }
     $this->cartRepository->update($cart);
 }
 public function testAddItemOptionProducts()
 {
     $optionProduct = $this->dummyData->getOptionProduct();
     $optionProductIds = [$optionProduct->getId()];
     $product = $this->dummyData->getProduct();
     $cartItem = $this->dummyData->getCartItem($product);
     $cart = $this->dummyData->getCart([$cartItem]);
     $this->optionProductRepository->shouldReceive('getAllOptionProductsByIds')->with($optionProductIds)->andReturn([$optionProduct])->once();
     $this->cartRepository->shouldReceive('getItemById')->with($cartItem->getId())->andReturn($cartItem)->once();
     $this->cartRepositoryShouldUpdateOnce($cart);
     $this->cartService->addItemOptionProducts($cartItem->getId(), $optionProductIds);
     $this->assertEntitiesEqual($optionProduct, $cart->getCartItems()[0]->getCartItemOptionProducts()[0]->getOptionProduct());
 }