コード例 #1
0
 public function testSave()
 {
     $this->quoteMock->expects($this->once())->method('isVirtual')->will($this->returnValue(false));
     $this->quoteMock->expects($this->once())->method('getItemsCount')->will($this->returnValue(1));
     $this->storeManagerMock->expects($this->once())->method('getStore')->will($this->returnValue($this->storeMock));
     $this->helperMock->expects($this->once())->method('isMessagesAllowed')->with('quote', $this->quoteMock, $this->storeMock)->will($this->returnValue(true));
     $this->giftMessageManagerMock->expects($this->once())->method('setMessage')->with($this->quoteMock, 'quote', $this->messageMock)->will($this->returnValue($this->giftMessageManagerMock));
     $this->assertTrue($this->cartRepository->save($this->cartId, $this->messageMock));
 }
コード例 #2
0
 /**
  * {@inheritDoc}
  */
 public function save($cartId, MessageInterface $giftMessage)
 {
     /** @var $quoteIdMask QuoteIdMask */
     $quoteIdMask = $this->quoteIdMaskFactory->create()->load($cartId, 'masked_id');
     return $this->repository->save($quoteIdMask->getQuoteId(), $giftMessage);
 }