Exemplo n.º 1
0
 /**
  * @param \Generated\Shared\Transfer\CartChangeTransfer $cartChangeTransfer
  *
  * @return \Generated\Shared\Transfer\QuoteTransfer
  */
 public function remove(CartChangeTransfer $cartChangeTransfer)
 {
     $expandedCartChangeTransfer = $this->expandChangedItems($cartChangeTransfer);
     $quoteTransfer = $this->cartStorageProvider->removeItems($expandedCartChangeTransfer);
     $this->messengerFacade->addSuccessMessage($this->createMessengerMessageTransfer(self::REMOVE_ITEMS_SUCCESS));
     return $this->recalculate($quoteTransfer);
 }
Exemplo n.º 2
0
 /**
  * @expectedException \Spryker\Zed\Cart\Business\Exception\InvalidQuantityExeption
  * @expectedExceptionMessage Could not change cart item "123" with "0" as value.
  *
  * @return void
  */
 public function testDecreaseWithZeroValue()
 {
     $itemId = '123';
     $newId = '123';
     $existingQuantity = 1;
     $newQuantity = 0;
     $quoteTransfer = $this->createQuoteWithItem($itemId, $existingQuantity);
     $newItem = $this->createItem($newId, $newQuantity);
     $change = new CartChangeTransfer();
     $change->addItem($newItem);
     $change->setQuote($quoteTransfer);
     $this->provider->removeItems($change);
 }