10
10
use Magento \Catalog \Api \ProductRepositoryInterface ;
11
11
use Magento \Catalog \Api \CategoryRepositoryInterface ;
12
12
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 ;
16
14
use Magento \TestFramework \ObjectManager ;
17
15
18
16
/**
22
20
* @magentoDbIsolation disabled
23
21
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
24
22
*/
25
- class DeepNestedCategoriesAndProductsTest extends \ Magento \ TestFramework \ Indexer \TestCase
23
+ class DeepNestedCategoriesAndProductsTest extends AbstractGraphqlCacheTest
26
24
{
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 */
33
26
private $ graphql ;
34
27
35
- /** @var SerializerInterface */
36
- private $ jsonSerializer ;
37
-
38
- /** @var MetadataPool */
39
- private $ metadataPool ;
40
-
41
28
/** @var Http */
42
29
private $ request ;
43
30
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
-
60
31
/**
61
32
* @inheritdoc
62
33
*/
63
34
protected function setUp (): void
64
35
{
65
- $ this -> objectManager = \ Magento \ TestFramework \ Helper \Bootstrap:: getObjectManager ();
36
+ parent :: setUp ();
66
37
$ 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);
69
38
$ this ->request = $ this ->objectManager ->get (Http::class);
70
39
}
71
40
@@ -148,9 +117,6 @@ public function testDispatchForCacheHeadersOnDeepNestedQueries(): void
148
117
$ result = $ this ->graphql ->dispatch ($ this ->request );
149
118
/** @var \Magento\Framework\App\Response\Http $response */
150
119
$ 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 );
154
120
$ result ->renderResult ($ response );
155
121
$ this ->assertEquals ('MISS ' , $ response ->getHeader ('X-Magento-Cache-Debug ' )->getFieldValue ());
156
122
$ actualCacheTags = explode (', ' , $ response ->getHeader ('X-Magento-Tags ' )->getFieldValue ());
@@ -161,4 +127,4 @@ public function testDispatchForCacheHeadersOnDeepNestedQueries(): void
161
127
)
162
128
);
163
129
}
164
- }
130
+ }
0 commit comments