13
13
use Magento \Framework \Registry ;
14
14
use Magento \Quote \Model \ResourceModel \Quote \CollectionFactory as QuoteCollectionFactory ;
15
15
use Magento \Sales \Api \OrderRepositoryInterface ;
16
+ use Magento \Sales \Model \OrderFactory ;
16
17
use Magento \Sales \Model \ResourceModel \Order \CollectionFactory ;
17
18
use Magento \TestFramework \Helper \Bootstrap ;
18
19
use Magento \TestFramework \TestCase \GraphQlAbstract ;
@@ -57,23 +58,31 @@ class CheckoutEndToEndTest extends GraphQlAbstract
57
58
*/
58
59
private $ orderRepository ;
59
60
61
+ /**
62
+ * @var OrderFactory
63
+ */
64
+ private $ orderFactory ;
65
+
60
66
/**
61
67
* @var array
62
68
*/
63
69
private $ headers = [];
64
70
71
+ /**
72
+ * @inheritdoc
73
+ */
65
74
protected function setUp (): void
66
75
{
67
- parent ::setUp ();
68
-
69
76
$ objectManager = Bootstrap::getObjectManager ();
77
+
70
78
$ this ->registry = $ objectManager ->get (Registry::class);
71
79
$ this ->quoteCollectionFactory = $ objectManager ->get (QuoteCollectionFactory::class);
72
80
$ this ->quoteResource = $ objectManager ->get (QuoteResource::class);
73
81
$ this ->quoteIdMaskFactory = $ objectManager ->get (QuoteIdMaskFactory::class);
74
- $ this ->customerRepository = Bootstrap:: getObjectManager () ->get (CustomerRepositoryInterface::class);
82
+ $ this ->customerRepository = $ objectManager ->get (CustomerRepositoryInterface::class);
75
83
$ this ->orderCollectionFactory = $ objectManager ->get (CollectionFactory::class);
76
84
$ this ->orderRepository = $ objectManager ->get (OrderRepositoryInterface::class);
85
+ $ this ->orderFactory = $ objectManager ->get (OrderFactory::class);
77
86
}
78
87
79
88
/**
@@ -97,8 +106,13 @@ public function testCheckoutWorkflow()
97
106
$ paymentMethod = $ this ->setShippingMethod ($ cartId , $ shippingMethod );
98
107
$ this ->setPaymentMethod ($ cartId , $ paymentMethod );
99
108
100
- $ orderId = $ this ->placeOrder ($ cartId );
101
- $ this ->checkOrderInHistory ($ orderId );
109
+ $ orderIncrementId = $ this ->placeOrder ($ cartId );
110
+
111
+ $ order = $ this ->orderFactory ->create ();
112
+ $ order ->loadByIncrementId ($ orderIncrementId );
113
+
114
+ $ this ->checkOrderInHistory ($ orderIncrementId );
115
+ $ this ->assertNotEmpty ($ order ->getEmailSent ());
102
116
}
103
117
104
118
/**
@@ -208,7 +222,7 @@ private function createEmptyCart(): string
208
222
private function addProductToCart (string $ cartId , float $ qty , string $ sku ): void
209
223
{
210
224
$ query = <<<QUERY
211
- mutation {
225
+ mutation {
212
226
addSimpleProductsToCart(
213
227
input: {
214
228
cart_id: " {$ cartId }"
@@ -350,7 +364,7 @@ private function setShippingMethod(string $cartId, array $method): array
350
364
$ query = <<<QUERY
351
365
mutation {
352
366
setShippingMethodsOnCart(input: {
353
- cart_id: " {$ cartId }",
367
+ cart_id: " {$ cartId }",
354
368
shipping_methods: [
355
369
{
356
370
carrier_code: " {$ method ['carrier_code ' ]}"
0 commit comments