@@ -54,8 +54,8 @@ protected function setUp(): void
54
54
$ this ->objectManager = Bootstrap::getObjectManager ();
55
55
$ this ->messageManager = $ this ->objectManager ->get (ManagerInterface::class);
56
56
$ this ->emailSenderMock = $ this ->getMockBuilder (EmailSender::class)
57
- ->disableOriginalConstructor ()
58
- ->getMock ();
57
+ ->disableOriginalConstructor ()
58
+ ->getMock ();
59
59
$ this ->model =$ this ->objectManager ->create (
60
60
Create::class,
61
61
['messageManager ' => $ this ->messageManager , 'emailSender ' => $ this ->emailSenderMock ]
@@ -612,11 +612,8 @@ public function testCreateOrderExistingCustomerDifferentAddresses()
612
612
* @magentoDataFixture Magento/Customer/_files/customer.php
613
613
* @magentoDbIsolation disabled
614
614
* @magentoAppIsolation enabled
615
- * @dataProvider emailCheckProvider
616
- * @param bool $sendConfirmation
617
- * @param bool $emailSent
618
615
*/
619
- public function testCreateOrderExistingCustomer ($ sendConfirmation , $ emailSent )
616
+ public function testCreateOrderExistingCustomer ()
620
617
{
621
618
$ productIdFromFixture = 1 ;
622
619
$ customerIdFromFixture = 1 ;
@@ -629,8 +626,7 @@ public function testCreateOrderExistingCustomer($sendConfirmation, $emailSent)
629
626
'billing_address ' => array_merge ($ this ->getValidAddressData (), ['save_in_address_book ' => '1 ' ]),
630
627
'shipping_method ' => $ shippingMethod ,
631
628
'comment ' => ['customer_note ' => '' ],
632
- 'send_confirmation ' => $ sendConfirmation ,
633
- 'email_sent ' => $ emailSent ,
629
+ 'send_confirmation ' => false ,
634
630
];
635
631
$ paymentData = ['method ' => $ paymentMethod ];
636
632
@@ -645,32 +641,12 @@ public function testCreateOrderExistingCustomer($sendConfirmation, $emailSent)
645
641
$ customerIdFromFixture
646
642
);
647
643
$ customerMock = $ this ->getMockedCustomer ();
648
- if ($ customerIdFromFixture && !$ emailSent ) {
649
- $ this ->emailSenderMock ->expects ($ this ->once ())
650
- ->method ('send ' )
651
- ->willReturn (true );
652
- } else {
653
- $ this ->emailSenderMock ->expects ($ this ->never ())->method ('send ' );
654
- }
655
644
656
645
$ this ->model ->getQuote ()->setCustomer ($ customerMock );
657
646
$ order = $ this ->model ->createOrder ();
658
647
$ this ->verifyCreatedOrder ($ order , $ shippingMethod );
659
648
}
660
649
661
- /**
662
- * Data provider for testApplySelectionOnTargetProvider.
663
- *
664
- * @return array
665
- */
666
- public function emailCheckProvider (): array
667
- {
668
- return [
669
- [false , true ],
670
- [true , false ]
671
- ];
672
- }
673
-
674
650
/**
675
651
* @magentoDataFixture Magento/Sales/_files/quote.php
676
652
* @magentoDataFixture Magento/Customer/_files/customer.php
@@ -850,6 +826,13 @@ private function verifyCreatedOrder($order, $shippingMethod)
850
826
{
851
827
/** Selectively check order data */
852
828
$ orderData = $ order ->getData ();
829
+ if (!$ order ->getEmailSent ()) {
830
+ $ this ->emailSenderMock ->expects ($ this ->once ())
831
+ ->method ('send ' )
832
+ ->willReturn (true );
833
+ } else {
834
+ $ this ->emailSenderMock ->expects ($ this ->never ())->method ('send ' );
835
+ }
853
836
self ::assertNotEmpty ($ orderData ['increment_id ' ], 'Order increment ID is empty. ' );
854
837
self ::assertEquals ($ this ->model ->getQuote ()->getId (), $ orderData ['quote_id ' ], 'Quote ID is invalid. ' );
855
838
self ::assertEquals (
0 commit comments