11
11
use Magento \Framework \Stdlib \DateTime \TimezoneInterface ;
12
12
use Magento \Sales \Api \Data \OrderInterface ;
13
13
use Magento \Sales \Model \Order ;
14
+ use Magento \Sales \Model \ResourceModel \Order \Item \Collection ;
14
15
use Magento \Sales \Model \ResourceModel \Order \Status \History \CollectionFactory as HistoryCollectionFactory ;
15
16
use Magento \Sales \Api \OrderItemRepositoryInterface ;
16
17
use Magento \Framework \Api \SearchCriteriaBuilder ;
@@ -421,6 +422,7 @@ public function testCanNotInvoiceWhenDidNotHaveQtyToInvoice()
421
422
public function testCanCreditMemo ()
422
423
{
423
424
$ totalPaid = 10 ;
425
+ $ this ->prepareOrderItem ();
424
426
$ this ->order ->setTotalPaid ($ totalPaid );
425
427
$ this ->priceCurrency ->expects ($ this ->once ())->method ('round ' )->with ($ totalPaid )->willReturnArgument (0 );
426
428
$ this ->assertTrue ($ this ->order ->canCreditmemo ());
@@ -436,6 +438,7 @@ public function testCanCreditMemoForZeroTotal()
436
438
$ grandTotal = 0 ;
437
439
$ totalPaid = 0 ;
438
440
$ totalRefunded = 0 ;
441
+ $ this ->prepareOrderItem ();
439
442
$ this ->order ->setGrandTotal ($ grandTotal );
440
443
$ this ->order ->setTotalPaid ($ totalPaid );
441
444
$ this ->assertFalse ($ this ->order ->canCreditmemoForZeroTotal ($ totalRefunded ));
@@ -444,6 +447,7 @@ public function testCanCreditMemoForZeroTotal()
444
447
public function testCanNotCreditMemoWithTotalNull ()
445
448
{
446
449
$ totalPaid = 0 ;
450
+ $ this ->prepareOrderItem ();
447
451
$ this ->order ->setTotalPaid ($ totalPaid );
448
452
$ this ->priceCurrency ->expects ($ this ->once ())->method ('round ' )->with ($ totalPaid )->willReturnArgument (0 );
449
453
$ this ->assertFalse ($ this ->order ->canCreditmemo ());
@@ -455,6 +459,7 @@ public function testCanNotCreditMemoWithAdjustmentNegative()
455
459
$ adjustmentNegative = 10 ;
456
460
$ totalRefunded = 90 ;
457
461
462
+ $ this ->prepareOrderItem ();
458
463
$ this ->order ->setTotalPaid ($ totalPaid );
459
464
$ this ->order ->setTotalRefunded ($ totalRefunded );
460
465
$ this ->order ->setAdjustmentNegative ($ adjustmentNegative );
@@ -469,6 +474,7 @@ public function testCanCreditMemoWithAdjustmentNegativeLowerThanTotalPaid()
469
474
$ adjustmentNegative = 9 ;
470
475
$ totalRefunded = 90 ;
471
476
477
+ $ this ->prepareOrderItem ();
472
478
$ this ->order ->setTotalPaid ($ totalPaid );
473
479
$ this ->order ->setTotalRefunded ($ totalRefunded );
474
480
$ this ->order ->setAdjustmentNegative ($ adjustmentNegative );
0 commit comments