public function testGetShippingDataMethodSet()
 {
     $shippingMethod = 'flatrate_flatrate';
     $shippingDescription = 'Kurier';
     $shippingAmount = '9.9900';
     $order = $this->getMockBuilder(\Magento\Sales\Model\Order::class)->disableOriginalConstructor()->getMock();
     $order->expects($this->once())->method('getShippingMethod')->willReturn($shippingMethod);
     $order->expects($this->once())->method('getShippingInclTax')->willReturn($shippingAmount);
     $order->expects($this->once())->method('getShippingDescription')->willReturn($shippingDescription);
     $this->assertEquals(['name' => __('Shipping Method') . ': ' . $shippingDescription, 'unitPrice' => $shippingAmount * 100, 'quantity' => 1], $this->model->getShippingData($order));
 }
Exemple #2
0
 /**
  * @inheritdoc
  */
 public function getDataForOrderCreate(\Magento\Sales\Model\Order $order)
 {
     $data = ['products' => $this->dataGetter->getProductsData($order)];
     $shippingData = $this->dataGetter->getShippingData($order);
     if ($shippingData) {
         $data['products'][] = $shippingData;
     }
     $buyerData = $this->dataGetter->getBuyerData($order);
     if ($buyerData) {
         $data['buyer'] = $buyerData;
     }
     $basicData = $this->dataGetter->getBasicData($order);
     return array_merge($basicData, $data);
 }