Skip to content

Commit 6a1b2ec

Browse files
authored
Merge pull request #532 from magento-performance/ACPT-1257
ACPT-1257: Fix Sales GraphQl tests on App Server
2 parents 0d4e970 + ee98f79 commit 6a1b2ec

File tree

3 files changed

+31
-2
lines changed

3 files changed

+31
-2
lines changed

app/code/Magento/Sales/Model/OrderRepository.php

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
use Magento\Framework\App\ObjectManager;
1313
use Magento\Framework\Exception\InputException;
1414
use Magento\Framework\Exception\NoSuchEntityException;
15+
use Magento\Framework\ObjectManager\ResetAfterRequestInterface;
1516
use Magento\Sales\Api\Data\OrderExtensionFactory;
1617
use Magento\Sales\Api\Data\OrderExtensionInterface;
1718
use Magento\Sales\Api\Data\OrderInterface;
@@ -29,7 +30,7 @@
2930
*
3031
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
3132
*/
32-
class OrderRepository implements \Magento\Sales\Api\OrderRepositoryInterface
33+
class OrderRepository implements \Magento\Sales\Api\OrderRepositoryInterface, ResetAfterRequestInterface
3334
{
3435
/**
3536
* @var Metadata
@@ -347,4 +348,12 @@ protected function addFilterGroupToCollection(
347348
$searchResult->addFieldToFilter($fields, $conditions);
348349
}
349350
}
351+
352+
/**
353+
* @inheritDoc
354+
*/
355+
public function _resetState(): void
356+
{
357+
$this->registry = [];
358+
}
350359
}

app/code/Magento/Tax/Model/Config.php

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,15 @@
1111
*/
1212
namespace Magento\Tax\Model;
1313

14+
use Magento\Framework\ObjectManager\ResetAfterRequestInterface;
1415
use Magento\Store\Model\Store;
1516

1617
/**
1718
* Class to set flags for tax display setting
1819
*
1920
* @SuppressWarnings(PHPMD.ExcessivePublicCount)
2021
*/
21-
class Config
22+
class Config implements ResetAfterRequestInterface
2223
{
2324
/**
2425
* Tax notifications
@@ -952,4 +953,14 @@ public function needPriceConversion($store = null)
952953
}
953954
return $res;
954955
}
956+
957+
/**
958+
* @inheritDoc
959+
*/
960+
public function _resetState(): void
961+
{
962+
$this->_priceIncludesTax = null;
963+
$this->_shippingPriceIncludeTax = null;
964+
$this->_needUseShippingExcludeTax = false;
965+
}
955966
}

dev/tests/api-functional/testsuite/Magento/GraphQl/Sales/ReorderTest.php

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,13 @@
77

88
namespace Magento\GraphQl\Sales;
99

10+
use Magento\Customer\Model\ResourceModel\CustomerRepository;
1011
use Magento\Framework\Exception\NoSuchEntityException;
1112
use Magento\Integration\Api\CustomerTokenServiceInterface;
1213
use Magento\Quote\Api\CartRepositoryInterface;
14+
use Magento\Quote\Model\QuoteRepository;
1315
use Magento\TestFramework\Helper\Bootstrap;
16+
use Magento\TestFramework\ObjectManager;
1417
use Magento\TestFramework\TestCase\GraphQlAbstract;
1518

1619
/**
@@ -185,6 +188,12 @@ public function testReorderWithLowStock()
185188
$expectedResponse['cart']['items'][0]['quantity'] = 20;
186189

187190
$this->assertResponseFields($response['reorderItems'], $expectedResponse);
191+
$customer = ObjectManager::getInstance()->get(CustomerRepository::class)
192+
->get(self::CUSTOMER_EMAIL);
193+
$quoteRepository = ObjectManager::getInstance()->get(QuoteRepository::class);
194+
$quote = $quoteRepository->getActiveForCustomer($customer->getId());
195+
$quote->setIsActive(false);
196+
$quoteRepository->save($quote);
188197
}
189198

190199
/**

0 commit comments

Comments
 (0)