Skip to content

Commit ed29f16

Browse files
committed
MC-36838: Cannot checkout with automatic customer group assignment
1 parent 11619df commit ed29f16

File tree

1 file changed

+44
-2
lines changed

1 file changed

+44
-2
lines changed

dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/Guest/PlaceOrderTest.php

Lines changed: 44 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
namespace Magento\GraphQl\Quote\Guest;
99

10-
use Exception;
10+
use Magento\Framework\App\Config\ScopeConfigInterface;
1111
use Magento\Framework\Registry;
1212
use Magento\GraphQl\Quote\GetMaskedQuoteIdByReservedOrderId;
1313
use Magento\Sales\Api\OrderRepositoryInterface;
@@ -56,7 +56,10 @@ protected function setUp(): void
5656
$this->orderCollectionFactory = $objectManager->get(CollectionFactory::class);
5757
$this->orderRepository = $objectManager->get(OrderRepositoryInterface::class);
5858
$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();
6063
}
6164

6265
/**
@@ -68,6 +71,7 @@ protected function setUp(): void
6871
* @magentoConfigFixture default_store payment/cashondelivery/active 1
6972
* @magentoConfigFixture default_store payment/checkmo/active 1
7073
* @magentoConfigFixture default_store payment/purchaseorder/active 1
74+
* @magentoConfigFixture default_store customer/create_account/auto_group_assign 0
7175
* @magentoApiDataFixture Magento/GraphQl/Quote/_files/guest/create_empty_cart.php
7276
* @magentoApiDataFixture Magento/GraphQl/Quote/_files/guest/set_guest_email.php
7377
* @magentoApiDataFixture Magento/GraphQl/Quote/_files/add_simple_product.php
@@ -94,6 +98,42 @@ public function testPlaceOrder()
9498
}
9599

96100
/**
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
97137
*/
98138
public function testPlaceOrderIfCartIdIsEmpty()
99139
{
@@ -115,6 +155,7 @@ public function testPlaceOrderIfCartIdIsEmpty()
115155
* @magentoConfigFixture default_store payment/cashondelivery/active 1
116156
* @magentoConfigFixture default_store payment/checkmo/active 1
117157
* @magentoConfigFixture default_store payment/purchaseorder/active 1
158+
* @magentoConfigFixture default_store customer/create_account/auto_group_assign 0
118159
* @magentoApiDataFixture Magento/GraphQl/Quote/_files/guest/create_empty_cart.php
119160
* @magentoApiDataFixture Magento/GraphQl/Quote/_files/add_simple_product.php
120161
* @magentoApiDataFixture Magento/GraphQl/Quote/_files/set_new_shipping_address.php
@@ -268,6 +309,7 @@ public function testPlaceOrderWithOutOfStockProduct()
268309
* @magentoConfigFixture default_store payment/cashondelivery/active 1
269310
* @magentoConfigFixture default_store payment/checkmo/active 1
270311
* @magentoConfigFixture default_store payment/purchaseorder/active 1
312+
* @magentoConfigFixture default_store customer/create_account/auto_group_assign 0
271313
* @magentoApiDataFixture Magento/GraphQl/Quote/_files/customer/create_empty_cart.php
272314
* @magentoApiDataFixture Magento/GraphQl/Quote/_files/add_simple_product.php
273315
* @magentoApiDataFixture Magento/GraphQl/Quote/_files/set_new_shipping_address.php

0 commit comments

Comments
 (0)