/** * @return void */ public function testDeleteById() { $cartId = 11; $itemId = 5; $this->quoteRepositoryMock->expects($this->once())->method('getActive')->with($cartId)->will($this->returnValue($this->quoteMock)); $this->quoteMock->expects($this->once())->method('getItemById')->with($itemId)->will($this->returnValue($this->quoteItemMock)); $this->quoteMock->expects($this->once())->method('removeItem'); $this->quoteMock->expects($this->once())->method('collectTotals')->will($this->returnValue($this->quoteMock)); $this->quoteRepositoryMock->expects($this->once())->method('save')->with($this->quoteMock); $this->assertTrue($this->repository->deleteById($cartId, $itemId)); }
/** * {@inheritdoc} */ public function deleteById($cartId, $itemId) { /** @var $quoteIdMask QuoteIdMask */ $quoteIdMask = $this->quoteIdMaskFactory->create()->load($cartId, 'masked_id'); return $this->repository->deleteById($quoteIdMask->getQuoteId(), $itemId); }