Ejemplo n.º 1
0
 public function testUpdateItems()
 {
     $data = [['qty' => 5.5, 'before_suggest_qty' => 5.5]];
     $infoDataObject = $this->objectManagerHelper->getObject('Magento\\Framework\\Object', ['data' => $data]);
     $this->checkoutSessionMock->expects($this->once())->method('getQuote')->will($this->returnValue($this->quoteMock));
     $this->eventManagerMock->expects($this->at(0))->method('dispatch')->with('checkout_cart_update_items_before', ['cart' => $this->cart, 'info' => $infoDataObject]);
     $this->eventManagerMock->expects($this->at(1))->method('dispatch')->with('checkout_cart_update_items_after', ['cart' => $this->cart, 'info' => $infoDataObject]);
     $result = $this->cart->updateItems($data);
     $this->assertSame($this->cart, $result);
 }
Ejemplo n.º 2
0
 /**
  * Update quote item
  *
  * @param int $itemId
  * @param int $itemQty
  * @throws LocalizedException
  * @return $this
  */
 public function updateQuoteItem($itemId, $itemQty)
 {
     $itemData = [$itemId => ['qty' => $this->normalize($itemQty)]];
     $this->cart->updateItems($itemData)->save();
     return $this;
 }