@@ -430,14 +430,19 @@ public function testCreateOrderNewCustomer()
430
430
* @magentoDataFixture Magento/Catalog/_files/product_simple.php
431
431
* @magentoDbIsolation enabled
432
432
* @magentoAppIsolation enabled
433
+ * @dataProvider createOrderNewCustomerWithFailedFirstPlaceOrderActionDataProvider
434
+ * @param string $customerEmailFirstAttempt
435
+ * @param string $customerEmailSecondAttempt
433
436
*/
434
- public function testCreateOrderNewCustomerWithFailedFirstPlaceOrderAction ()
435
- {
437
+ public function testCreateOrderNewCustomerWithFailedFirstPlaceOrderAction (
438
+ $ customerEmailFirstAttempt ,
439
+ $ customerEmailSecondAttempt
440
+ ) {
436
441
$ productIdFromFixture = 1 ;
437
442
$ shippingMethod = 'freeshipping_freeshipping ' ;
438
443
$ paymentMethod = 'checkmo ' ;
439
444
$ shippingAddressAsBilling = 1 ;
440
- $ customerEmail =
' [email protected] ' ;
445
+ $ customerEmail = $ customerEmailFirstAttempt ;
441
446
$ orderData = [
442
447
'currency ' => 'USD ' ,
443
448
'account ' => ['group_id ' => '1 ' , 'email ' => $ customerEmail ],
@@ -469,10 +474,44 @@ public function testCreateOrderNewCustomerWithFailedFirstPlaceOrderAction()
469
474
Bootstrap::getObjectManager ()->removeSharedInstance (OrderManagementInterface::class);
470
475
}
471
476
477
+ $ customerEmail = $ customerEmailSecondAttempt ? :$ this ->_model ->getQuote ()->getCustomer ()->getEmail ();
478
+ $ orderData ['account ' ]['email ' ] = $ customerEmailSecondAttempt ;
479
+
480
+ $ this ->_preparePreconditionsForCreateOrder (
481
+ $ productIdFromFixture ,
482
+ $ customerEmail ,
483
+ $ shippingMethod ,
484
+ $ shippingAddressAsBilling ,
485
+ $ paymentData ,
486
+ $ orderData ,
487
+ $ paymentMethod
488
+ );
489
+
472
490
$ order = $ this ->_model ->createOrder ();
473
491
$ this ->_verifyCreatedOrder ($ order , $ shippingMethod );
474
492
}
475
493
494
+ /**
495
+ * Email before and after failed first place order action.
496
+ *
497
+ * @case #1 Is the same.
498
+ * @case #2 Is empty.
499
+ * @case #3 Filled after failed first place order action.
500
+ * @case #4 Empty after failed first place order action.
501
+ * @case #5 Changed after failed first place order action.
502
+ * @return array
503
+ */
504
+ public function createOrderNewCustomerWithFailedFirstPlaceOrderActionDataProvider ()
505
+ {
506
+ return [
507
+
508
+ 2 => ['' , '' ],
509
+
510
+
511
+
512
+ ];
513
+ }
514
+
476
515
/**
477
516
* @magentoDataFixture Magento/Catalog/_files/product_simple.php
478
517
* @magentoDataFixture Magento/Customer/_files/customer.php
0 commit comments