File tree Expand file tree Collapse file tree 2 files changed +8
-10
lines changed
app/code/Magento/Sales/Model/AdminOrder
dev/tests/integration/testsuite/Magento/Sales/Model/AdminOrder Expand file tree Collapse file tree 2 files changed +8
-10
lines changed Original file line number Diff line number Diff line change @@ -745,10 +745,12 @@ public function getCustomerCart()
745
745
try {
746
746
$ this ->_cart = $ this ->quoteRepository ->getForCustomer ($ customerId , [$ storeId ]);
747
747
} catch (\Magento \Framework \Exception \NoSuchEntityException $ e ) {
748
- $ this ->_cart ->setStore ($ this ->getSession ()->getStore ());
749
- $ customerData = $ this ->customerRepository ->getById ($ customerId );
750
- $ this ->_cart ->assignCustomer ($ customerData );
751
- $ this ->quoteRepository ->save ($ this ->_cart );
748
+ if ($ this ->getQuote ()->hasItems ()) {
749
+ $ this ->_cart ->setStore ($ this ->getSession ()->getStore ());
750
+ $ customerData = $ this ->customerRepository ->getById ($ customerId );
751
+ $ this ->_cart ->assignCustomer ($ customerData );
752
+ $ this ->quoteRepository ->save ($ this ->_cart );
753
+ }
752
754
}
753
755
}
754
756
Original file line number Diff line number Diff line change @@ -693,12 +693,8 @@ public function testGetCustomerCartNewCart()
693
693
694
694
/** SUT execution */
695
695
$ customerQuote = $ this ->model ->getCustomerCart ();
696
- self ::assertNotEmpty ($ customerQuote ->getId (), 'Quote ID is invalid. ' );
697
- self ::assertEquals (
698
- $ customerEmailFromFixture ,
699
- $ customerQuote ->getCustomerEmail (),
700
- 'Customer data is preserved incorrectly in a newly quote. '
701
- );
696
+ self ::assertInstanceOf (Quote::class, $ customerQuote );
697
+ self ::assertEmpty ($ customerQuote ->getData ());
702
698
}
703
699
704
700
/**
You can’t perform that action at this time.
0 commit comments