@@ -310,21 +310,20 @@ public function testAssignCustomerThrowsExceptionIfCartIsAssignedToDifferentStor
310
310
}
311
311
312
312
/**
313
- * @magentoApiDataFixture Magento/Checkout/_files/quote_with_address_saved .php
313
+ * @magentoApiDataFixture Magento/Checkout/_files/quote_with_items_saved .php
314
314
* @magentoApiDataFixture Magento/Sales/_files/quote.php
315
- * @expectedException \Exception
316
315
*/
317
- public function testAssignCustomerThrowsExceptionIfCustomerAlreadyHasActiveCart ()
316
+ public function testAssignCustomerCartMerged ()
318
317
{
319
318
/** @var $customer \Magento\Customer\Model\Customer */
320
319
$ customer = $ this ->objectManager ->create (\Magento \Customer \Model \Customer::class)->load (1 );
321
320
// Customer has a quote with reserved order ID test_order_1 (see fixture)
322
321
/** @var $customerQuote \Magento\Quote\Model\Quote */
323
322
$ customerQuote = $ this ->objectManager ->create (\Magento \Quote \Model \Quote::class)
324
- ->load ('test_order_1 ' , 'reserved_order_id ' );
325
- $ customerQuote ->setIsActive (1 )->save ();
323
+ ->load ('test_order_item_with_items ' , 'reserved_order_id ' );
326
324
/** @var $quote \Magento\Quote\Model\Quote */
327
325
$ quote = $ this ->objectManager ->create (\Magento \Quote \Model \Quote::class)->load ('test01 ' , 'reserved_order_id ' );
326
+ $ expectedQuoteItemsQty = $ customerQuote ->getItemsQty () + $ quote ->getItemsQty ();
328
327
329
328
$ cartId = $ quote ->getId ();
330
329
$ customerId = $ customer ->getId ();
@@ -346,11 +345,11 @@ public function testAssignCustomerThrowsExceptionIfCustomerAlreadyHasActiveCart(
346
345
'customerId ' => $ customerId ,
347
346
'storeId ' => 1 ,
348
347
];
349
- $ this ->_webApiCall ($ serviceInfo , $ requestData );
348
+ $ this ->assertTrue ( $ this -> _webApiCall ( $ serviceInfo , $ requestData) );
350
349
351
- $ this ->expectExceptionMessage (
352
- " The customer can't be assigned to the cart because the customer already has an active cart. "
353
- );
350
+ $ mergedQuote = $ this ->objectManager -> create (\ Magento \ Quote \ Model \Quote::class)-> load ( ' test01 ' , ' reserved_order_id ' );
351
+
352
+ $ this -> assertEquals ( $ expectedQuoteItemsQty , $ mergedQuote -> getItemsQty () );
354
353
}
355
354
356
355
/**
0 commit comments