Пример #1
0
 public function testSave()
 {
     $this->quoteRepositoryMock->expects($this->any())->method('get')->willReturn($this->quoteMock);
     $this->quoteMock->expects($this->once())->method('getItemsCount')->willReturn(1);
     $this->quoteMock->expects($this->once())->method('getIsVirtual')->willReturn(false);
     $customerMock = $this->getMock('Magento\\Customer\\Api\\Data\\CustomerInterface', [], [], '', false);
     $this->quoteMock->expects($this->once())->method('getCustomer')->willReturn($customerMock);
     $this->messageMock->expects($this->any())->method('setCustomerId');
     $this->messageMock->expects($this->any())->method('setGiftMessageId');
     $this->cacheMock->expects($this->once())->method('save');
     $this->assertTrue($this->cartRepository->save($this->cartId, $this->messageMock));
 }
Пример #2
0
 public function testSave()
 {
     $this->quoteRepositoryMock->expects($this->any())->method('get')->willReturn($this->quoteMock);
     $this->quoteItemMock->expects($this->once())->method('getItemId')->willReturn($this->itemId);
     $this->quoteItemMock->expects($this->once())->method('getProductType')->willReturn(\Magento\Catalog\Model\Product\Type::TYPE_SIMPLE);
     $customerMock = $this->getMock('Magento\\Customer\\Api\\Data\\CustomerInterface', [], [], '', false);
     $this->quoteMock->expects($this->once())->method('getCustomer')->willReturn($customerMock);
     $this->messageMock->expects($this->any())->method('setCustomerId');
     $this->messageMock->expects($this->any())->method('setGiftMessageId');
     $this->cacheMock->expects($this->once())->method('save');
     $this->assertTrue($this->itemRepository->save($this->cartId, $this->messageMock, $this->itemId));
 }