Skip to content

Commit cd6dc34

Browse files
committed
MC-29425: [WebAPI Test] Failing Test: Magento.GraphQl.Quote.Customer.GetCustomerCartTest.testGetCustomerCartSecondStore
- Removed the rollback fixtures and added tear down
1 parent 4d3ec60 commit cd6dc34

File tree

1 file changed

+27
-4
lines changed

1 file changed

+27
-4
lines changed

dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/Customer/GetCustomerCartTest.php

Lines changed: 27 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,13 +28,40 @@ class GetCustomerCartTest extends GraphQlAbstract
2828
*/
2929
private $customerTokenService;
3030

31+
/**
32+
* @var \Magento\Framework\ObjectManagerInterface
33+
*/
34+
protected $objectManager;
35+
3136
protected function setUp()
3237
{
3338
$objectManager = Bootstrap::getObjectManager();
3439
$this->getMaskedQuoteIdByReservedOrderId = $objectManager->get(GetMaskedQuoteIdByReservedOrderId::class);
3540
$this->customerTokenService = $objectManager->get(CustomerTokenServiceInterface::class);
3641
}
3742

43+
/**
44+
* @inheritdoc
45+
*/
46+
protected function tearDown()
47+
{
48+
/** @var \Magento\Framework\Registry $registry */
49+
$registry = Bootstrap::getObjectManager()->get(\Magento\Framework\Registry::class);
50+
$registry->unregister('isSecureArea');
51+
$registry->register('isSecureArea', true);
52+
53+
/** @var $order \Magento\Quote\Model\Quote */
54+
$quoteCollection = Bootstrap::getObjectManager()->create(\Magento\Quote\Model\ResourceModel\Quote\Collection::class);
55+
foreach ($quoteCollection as $quote) {
56+
$quote->delete();
57+
}
58+
59+
$registry->unregister('isSecureArea');
60+
$registry->register('isSecureArea', false);
61+
62+
parent::tearDown();
63+
}
64+
3865
/**
3966
* Query for an existing active customer cart
4067
*
@@ -87,7 +114,6 @@ public function testGetLoggedInCustomerCartWithoutMaskedQuoteId()
87114
* Query for customer cart for a user with no existing active cart
88115
*
89116
* @magentoApiDataFixture Magento/Customer/_files/customer.php
90-
* @magentoApiDataFixture Magento/Checkout/_files/rollback_quote.php
91117
*/
92118
public function testGetNewCustomerCart()
93119
{
@@ -138,7 +164,6 @@ public function testGetCustomerCartAfterTokenRevoked()
138164
* Querying for the customer cart twice->should return the same cart
139165
*
140166
* @magentoApiDataFixture Magento/Customer/_files/customer.php
141-
* @magentoApiDataFixture Magento/Checkout/_files/rollback_quote.php
142167
*/
143168
public function testRequestCustomerCartTwice()
144169
{
@@ -161,7 +186,6 @@ public function testRequestCustomerCartTwice()
161186
* @magentoApiDataFixture Magento/GraphQl/Catalog/_files/simple_product.php
162187
* @magentoApiDataFixture Magento/GraphQl/Quote/_files/add_simple_product.php
163188
* @magentoApiDataFixture Magento/GraphQl/Quote/_files/make_cart_inactive.php
164-
* @magentoApiDataFixture Magento/Checkout/_files/rollback_quote.php
165189
*/
166190
public function testGetInactiveCustomerCart()
167191
{
@@ -176,7 +200,6 @@ public function testGetInactiveCustomerCart()
176200
/**
177201
* Querying for an existing customer cart for second store
178202
*
179-
* @magentoApiDataFixture Magento/Checkout/_files/rollback_quote.php
180203
* @magentoApiDataFixture Magento/Checkout/_files/active_quote_customer_not_default_store.php
181204
*/
182205
public function testGetCustomerCartSecondStore()

0 commit comments

Comments
 (0)