Beispiel #1
0
 /**
  * test for convert method
  */
 public function testConvert()
 {
     $this->quoteItemMock->expects($this->exactly(2))->method('getProduct')->willReturn($this->productMock);
     $this->productMock->expects($this->once())->method('getTypeInstance')->willReturn($this->productTypeMock);
     $this->productTypeMock->expects($this->once())->method('getOrderOptions')->with($this->productMock)->willReturn(['option']);
     $this->objectCopyServiceMock->expects($this->at(0))->method('getDataFromFieldset')->with('quote_convert_item', 'to_order_item', $this->quoteItemMock)->willReturn([]);
     $this->objectCopyServiceMock->expects($this->at(1))->method('getDataFromFieldset')->with('quote_convert_item', 'to_order_item_discount', $this->quoteItemMock)->willReturn([]);
     $this->orderItemBuilderMock->expects($this->once())->method('create')->willReturn($this->orderItemMock);
     $this->assertInstanceOf('Magento\\Sales\\Model\\Order\\Item', $this->converter->convert($this->quoteItemMock, []));
 }
Beispiel #2
0
 public function testPrepareQuoteForNewCustomer()
 {
     $customerAddressMock = $this->getMockBuilder('Magento\\Customer\\Api\\Data\\AddressInterface')->disableOriginalConstructor()->getMock();
     $this->addressMock->expects($this->any())->method('exportCustomerAddress')->willReturn($customerAddressMock);
     $this->addressMock->expects($this->any())->method('getData')->willReturn([]);
     $this->addressFactoryMock->expects($this->any())->method('create')->willReturn($this->addressMock);
     $this->quoteMock->expects($this->any())->method('isVirtual')->willReturn(false);
     $this->quoteMock->expects($this->once())->method('getBillingAddress')->willReturn($this->addressMock);
     $this->quoteMock->expects($this->once())->method('getShippingAddress')->willReturn($this->addressMock);
     $customerDataMock = $this->getMockBuilder('Magento\\Customer\\Api\\Data\\CustomerInterface')->disableOriginalConstructor()->getMock();
     $this->customerFactoryMock->expects($this->once())->method('create')->willReturn($customerDataMock);
     $this->copyObjectMock->expects($this->any())->method('getDataFromFieldset')->willReturn([]);
     $this->dataObjectHelper->expects($this->any())->method('populateWithArray')->willReturnSelf();
     $this->assertInstanceOf('Magento\\Quote\\Model\\Quote', $this->quote->prepareQuoteForNewCustomer($this->quoteMock));
 }