7
7
8
8
namespace Magento \GraphQl \Quote \Guest ;
9
9
10
- use Exception ;
10
+ use Magento \ Framework \ App \ Config \ ScopeConfigInterface ;
11
11
use Magento \Framework \Registry ;
12
12
use Magento \GraphQl \Quote \GetMaskedQuoteIdByReservedOrderId ;
13
13
use Magento \Sales \Api \OrderRepositoryInterface ;
@@ -56,7 +56,10 @@ protected function setUp(): void
56
56
$ this ->orderCollectionFactory = $ objectManager ->get (CollectionFactory::class);
57
57
$ this ->orderRepository = $ objectManager ->get (OrderRepositoryInterface::class);
58
58
$ this ->orderFactory = $ objectManager ->get (OrderFactory::class);
59
- $ this ->registry = Bootstrap::getObjectManager ()->get (Registry::class);
59
+ $ this ->registry = $ objectManager ->get (Registry::class);
60
+ /** @var ScopeConfigInterface $scopeConfig */
61
+ $ scopeConfig = $ objectManager ->get (ScopeConfigInterface::class);
62
+ $ scopeConfig ->clean ();
60
63
}
61
64
62
65
/**
@@ -68,6 +71,7 @@ protected function setUp(): void
68
71
* @magentoConfigFixture default_store payment/cashondelivery/active 1
69
72
* @magentoConfigFixture default_store payment/checkmo/active 1
70
73
* @magentoConfigFixture default_store payment/purchaseorder/active 1
74
+ * @magentoConfigFixture default_store customer/create_account/auto_group_assign 0
71
75
* @magentoApiDataFixture Magento/GraphQl/Quote/_files/guest/create_empty_cart.php
72
76
* @magentoApiDataFixture Magento/GraphQl/Quote/_files/guest/set_guest_email.php
73
77
* @magentoApiDataFixture Magento/GraphQl/Quote/_files/add_simple_product.php
@@ -94,6 +98,42 @@ public function testPlaceOrder()
94
98
}
95
99
96
100
/**
101
+ * @magentoApiDataFixture Magento/GraphQl/Catalog/_files/simple_product.php
102
+ * @magentoConfigFixture default_store carriers/flatrate/active 1
103
+ * @magentoConfigFixture default_store carriers/tablerate/active 1
104
+ * @magentoConfigFixture default_store carriers/freeshipping/active 1
105
+ * @magentoConfigFixture default_store payment/banktransfer/active 1
106
+ * @magentoConfigFixture default_store payment/cashondelivery/active 1
107
+ * @magentoConfigFixture default_store payment/checkmo/active 1
108
+ * @magentoConfigFixture default_store payment/purchaseorder/active 1
109
+ * @magentoConfigFixture default_store customer/create_account/auto_group_assign 1
110
+ * @magentoApiDataFixture Magento/GraphQl/Quote/_files/guest/create_empty_cart.php
111
+ * @magentoApiDataFixture Magento/GraphQl/Quote/_files/guest/set_guest_email.php
112
+ * @magentoApiDataFixture Magento/GraphQl/Quote/_files/add_simple_product.php
113
+ * @magentoApiDataFixture Magento/GraphQl/Quote/_files/set_new_shipping_address.php
114
+ * @magentoApiDataFixture Magento/GraphQl/Quote/_files/set_new_billing_address.php
115
+ * @magentoApiDataFixture Magento/GraphQl/Quote/_files/set_flatrate_shipping_method.php
116
+ * @magentoApiDataFixture Magento/GraphQl/Quote/_files/set_checkmo_payment_method.php
117
+ */
118
+ public function testPlaceOrderWithAutoGroup ()
119
+ {
120
+ $ reservedOrderId = 'test_quote ' ;
121
+ $ maskedQuoteId = $ this ->getMaskedQuoteIdByReservedOrderId ->execute ($ reservedOrderId );
122
+
123
+ $ query = $ this ->getQuery ($ maskedQuoteId );
124
+ $ response = $ this ->graphQlMutation ($ query );
125
+
126
+ self ::assertArrayHasKey ('placeOrder ' , $ response );
127
+ self ::assertArrayHasKey ('order_number ' , $ response ['placeOrder ' ]['order ' ]);
128
+ self ::assertEquals ($ reservedOrderId , $ response ['placeOrder ' ]['order ' ]['order_number ' ]);
129
+ $ orderIncrementId = $ response ['placeOrder ' ]['order ' ]['order_number ' ];
130
+ $ order = $ this ->orderFactory ->create ();
131
+ $ order ->loadByIncrementId ($ orderIncrementId );
132
+ $ this ->assertNotEmpty ($ order ->getEmailSent ());
133
+ }
134
+
135
+ /**
136
+ * @magentoConfigFixture default_store customer/create_account/auto_group_assign 0
97
137
*/
98
138
public function testPlaceOrderIfCartIdIsEmpty ()
99
139
{
@@ -115,6 +155,7 @@ public function testPlaceOrderIfCartIdIsEmpty()
115
155
* @magentoConfigFixture default_store payment/cashondelivery/active 1
116
156
* @magentoConfigFixture default_store payment/checkmo/active 1
117
157
* @magentoConfigFixture default_store payment/purchaseorder/active 1
158
+ * @magentoConfigFixture default_store customer/create_account/auto_group_assign 0
118
159
* @magentoApiDataFixture Magento/GraphQl/Quote/_files/guest/create_empty_cart.php
119
160
* @magentoApiDataFixture Magento/GraphQl/Quote/_files/add_simple_product.php
120
161
* @magentoApiDataFixture Magento/GraphQl/Quote/_files/set_new_shipping_address.php
@@ -268,6 +309,7 @@ public function testPlaceOrderWithOutOfStockProduct()
268
309
* @magentoConfigFixture default_store payment/cashondelivery/active 1
269
310
* @magentoConfigFixture default_store payment/checkmo/active 1
270
311
* @magentoConfigFixture default_store payment/purchaseorder/active 1
312
+ * @magentoConfigFixture default_store customer/create_account/auto_group_assign 0
271
313
* @magentoApiDataFixture Magento/GraphQl/Quote/_files/customer/create_empty_cart.php
272
314
* @magentoApiDataFixture Magento/GraphQl/Quote/_files/add_simple_product.php
273
315
* @magentoApiDataFixture Magento/GraphQl/Quote/_files/set_new_shipping_address.php
0 commit comments