/** * @param Address $object * @param array $data * @return OrderAddressInterface */ public function convert(Address $object, $data = []) { $orderAddress = $this->orderAddressRepository->create(); $orderAddressData = $this->objectCopyService->getDataFromFieldset('quote_convert_address', 'to_order_address', $object); $this->dataObjectHelper->populateWithArray($orderAddress, array_merge($orderAddressData, $data), '\\Magento\\Sales\\Api\\Data\\OrderAddressInterface'); return $orderAddress; }
public function testCreate() { $address = $this->getMock('Magento\\Sales\\Model\\Order\\Address', ['getEntityId'], [], '', false); $this->metadata->expects($this->once())->method('getNewInstance')->willReturn($address); $this->assertEquals($address, $this->subject->create()); }