예제 #1
0
 /**
  * @expectedException \Exception
  * @expectedExceptionMessage Cart contains virtual product(s) only. Shipping address is not applicable
  */
 public function testGetAddressOfQuoteWithVirtualProducts()
 {
     $quoteMock = $this->getMock('\\Magento\\Sales\\Model\\Quote', [], [], '', false);
     $this->quoteLoaderMock->expects($this->once())->method('load')->with('cartId', '123')->will($this->returnValue($quoteMock));
     $quoteMock->expects($this->any())->method('isVirtual')->will($this->returnValue(true));
     $quoteMock->expects($this->never())->method('getShippingAddress');
     $this->service->getAddress('cartId');
 }
예제 #2
0
 public function testGetAddress()
 {
     $quoteMock = $this->getMock('\\Magento\\Sales\\Model\\Quote', [], [], '', false);
     $this->quoteRepositoryMock->expects($this->once())->method('get')->with('cartId')->will($this->returnValue($quoteMock));
     $addressMock = $this->getMock('\\Magento\\Sales\\Model\\Quote\\Address', [], [], '', false);
     $quoteMock->expects($this->any())->method('getBillingAddress')->will($this->returnValue($addressMock));
     $this->converterMock->expects($this->once())->method('convertModelToDataObject')->with($addressMock)->will($this->returnValue('BillingAddress'));
     $this->assertEquals('BillingAddress', $this->service->getAddress('cartId'));
 }