Skip to content

Commit cede6e9

Browse files
author
Prabhu Ram
committed
596: Category with Products with...(deep nesting) (Integration Test for Tag Cache Generation)
- Fixed review comments
1 parent 0fa84fa commit cede6e9

File tree

1 file changed

+5
-39
lines changed

1 file changed

+5
-39
lines changed

dev/tests/integration/testsuite/Magento/GraphQlCache/Controller/Catalog/DeepNestedCategoriesAndProductsTest.php

Lines changed: 5 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,7 @@
1010
use Magento\Catalog\Api\ProductRepositoryInterface;
1111
use Magento\Catalog\Api\CategoryRepositoryInterface;
1212
use Magento\Framework\App\Request\Http;
13-
use Magento\Framework\EntityManager\MetadataPool;
14-
use Magento\Framework\Serialize\SerializerInterface;
15-
use Magento\TestFramework\Helper\Bootstrap;
13+
use Magento\GraphQlCache\Controller\AbstractGraphqlCacheTest;
1614
use Magento\TestFramework\ObjectManager;
1715

1816
/**
@@ -22,50 +20,21 @@
2220
* @magentoDbIsolation disabled
2321
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
2422
*/
25-
class DeepNestedCategoriesAndProductsTest extends \Magento\TestFramework\Indexer\TestCase
23+
class DeepNestedCategoriesAndProductsTest extends AbstractGraphqlCacheTest
2624
{
27-
const CONTENT_TYPE = 'application/json';
28-
29-
/** @var \Magento\Framework\ObjectManagerInterface */
30-
private $objectManager;
31-
32-
/** @var GraphQl */
25+
/** @var \Magento\GraphQl\Controller\GraphQl */
3326
private $graphql;
3427

35-
/** @var SerializerInterface */
36-
private $jsonSerializer;
37-
38-
/** @var MetadataPool */
39-
private $metadataPool;
40-
4128
/** @var Http */
4229
private $request;
4330

44-
/**
45-
* @inheritdoc
46-
*/
47-
public static function setUpBeforeClass()
48-
{
49-
$db = Bootstrap::getInstance()->getBootstrap()
50-
->getApplication()
51-
->getDbInstance();
52-
if (!$db->isDbDumpExists()) {
53-
throw new \LogicException('DB dump does not exist.');
54-
}
55-
$db->restoreFromDbDump();
56-
57-
parent::setUpBeforeClass();
58-
}
59-
6031
/**
6132
* @inheritdoc
6233
*/
6334
protected function setUp(): void
6435
{
65-
$this->objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager();
36+
parent::setUp();
6637
$this->graphql = $this->objectManager->get(\Magento\GraphQl\Controller\GraphQl::class);
67-
$this->jsonSerializer = $this->objectManager->get(SerializerInterface::class);
68-
$this->metadataPool = $this->objectManager->get(MetadataPool::class);
6938
$this->request = $this->objectManager->get(Http::class);
7039
}
7140

@@ -148,9 +117,6 @@ public function testDispatchForCacheHeadersOnDeepNestedQueries(): void
148117
$result = $this->graphql->dispatch($this->request);
149118
/** @var \Magento\Framework\App\Response\Http $response */
150119
$response = $this->objectManager->get(\Magento\Framework\App\Response\Http::class);
151-
/** @var $registry \Magento\Framework\Registry */
152-
$registry = $this->objectManager->get(\Magento\Framework\Registry::class);
153-
$registry->register('use_page_cache_plugin', true, true);
154120
$result->renderResult($response);
155121
$this->assertEquals('MISS', $response->getHeader('X-Magento-Cache-Debug')->getFieldValue());
156122
$actualCacheTags = explode(',', $response->getHeader('X-Magento-Tags')->getFieldValue());
@@ -161,4 +127,4 @@ public function testDispatchForCacheHeadersOnDeepNestedQueries(): void
161127
)
162128
);
163129
}
164-
}
130+
}

0 commit comments

Comments
 (0)