Skip to content

Commit d17a99f

Browse files
committed
MAGETWO-91676: Model related data missing in order rest api
- Fix for unit tests
1 parent 21fb25a commit d17a99f

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

app/code/Magento/Sales/Test/Unit/Model/OrderTest.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
use Magento\Framework\Stdlib\DateTime\TimezoneInterface;
1212
use Magento\Sales\Api\Data\OrderInterface;
1313
use Magento\Sales\Model\Order;
14+
use Magento\Sales\Model\ResourceModel\Order\Item\Collection;
1415
use Magento\Sales\Model\ResourceModel\Order\Status\History\CollectionFactory as HistoryCollectionFactory;
1516
use Magento\Sales\Api\OrderItemRepositoryInterface;
1617
use Magento\Framework\Api\SearchCriteriaBuilder;
@@ -421,6 +422,7 @@ public function testCanNotInvoiceWhenDidNotHaveQtyToInvoice()
421422
public function testCanCreditMemo()
422423
{
423424
$totalPaid = 10;
425+
$this->prepareOrderItem();
424426
$this->order->setTotalPaid($totalPaid);
425427
$this->priceCurrency->expects($this->once())->method('round')->with($totalPaid)->willReturnArgument(0);
426428
$this->assertTrue($this->order->canCreditmemo());
@@ -436,6 +438,7 @@ public function testCanCreditMemoForZeroTotal()
436438
$grandTotal = 0;
437439
$totalPaid = 0;
438440
$totalRefunded = 0;
441+
$this->prepareOrderItem();
439442
$this->order->setGrandTotal($grandTotal);
440443
$this->order->setTotalPaid($totalPaid);
441444
$this->assertFalse($this->order->canCreditmemoForZeroTotal($totalRefunded));
@@ -444,6 +447,7 @@ public function testCanCreditMemoForZeroTotal()
444447
public function testCanNotCreditMemoWithTotalNull()
445448
{
446449
$totalPaid = 0;
450+
$this->prepareOrderItem();
447451
$this->order->setTotalPaid($totalPaid);
448452
$this->priceCurrency->expects($this->once())->method('round')->with($totalPaid)->willReturnArgument(0);
449453
$this->assertFalse($this->order->canCreditmemo());
@@ -455,6 +459,7 @@ public function testCanNotCreditMemoWithAdjustmentNegative()
455459
$adjustmentNegative = 10;
456460
$totalRefunded = 90;
457461

462+
$this->prepareOrderItem();
458463
$this->order->setTotalPaid($totalPaid);
459464
$this->order->setTotalRefunded($totalRefunded);
460465
$this->order->setAdjustmentNegative($adjustmentNegative);
@@ -469,6 +474,7 @@ public function testCanCreditMemoWithAdjustmentNegativeLowerThanTotalPaid()
469474
$adjustmentNegative = 9;
470475
$totalRefunded = 90;
471476

477+
$this->prepareOrderItem();
472478
$this->order->setTotalPaid($totalPaid);
473479
$this->order->setTotalRefunded($totalRefunded);
474480
$this->order->setAdjustmentNegative($adjustmentNegative);

0 commit comments

Comments
 (0)