public function testGet() { $messageId = 123; $itemId = 2; $this->quoteMock->expects($this->once())->method('getItemById')->with($itemId)->will($this->returnValue($this->quoteItemMock)); $this->quoteItemMock->expects($this->once())->method('getGiftMessageId')->will($this->returnValue($messageId)); $this->messageFactoryMock->expects($this->once())->method('create')->will($this->returnValue($this->messageMock)); $this->messageMock->expects($this->once())->method('load')->with($messageId)->will($this->returnValue($this->messageMock)); $this->assertEquals($this->messageMock, $this->itemRepository->get($this->cartId, $itemId)); }
/** * {@inheritDoc} */ public function get($cartId, $itemId) { /** @var $quoteIdMask QuoteIdMask */ $quoteIdMask = $this->quoteIdMaskFactory->create()->load($cartId, 'masked_id'); return $this->repository->get($quoteIdMask->getQuoteId(), $itemId); }