コード例 #1
0
ファイル: Order.php プロジェクト: whoople/magento2-testing
 /**
  * Convert order object to Shipment
  *
  * @param   \Magento\Sales\Model\Order $order
  * @return  \Magento\Sales\Model\Order\Shipment
  */
 public function toShipment(\Magento\Sales\Model\Order $order)
 {
     $shipment = $this->shipmentRepository->create();
     $shipment->setOrder($order)->setStoreId($order->getStoreId())->setCustomerId($order->getCustomerId())->setBillingAddressId($order->getBillingAddressId())->setShippingAddressId($order->getShippingAddressId());
     $this->_objectCopyService->copyFieldsetToTarget('sales_convert_order', 'to_shipment', $order, $shipment);
     return $shipment;
 }
コード例 #2
0
 public function testCreate()
 {
     $shipment = $this->getMock('Magento\\Sales\\Model\\Order\\Shipment', [], [], '', false);
     $this->metadata->expects($this->once())->method('getNewInstance')->willReturn($shipment);
     $this->assertEquals($shipment, $this->subject->create());
 }