@@ -83,19 +83,13 @@ public function testCacheTagForCategoriesWithProduct()
83
83
$ firstProduct = $ productRepository ->get ($ firstProductSku , false , null , true );
84
84
$ productRepository ->get ($ secondProductSku , false , null , true );
85
85
86
- $ categoryQueryVariables =[
87
- 'id ' => $ categoryId ,
88
- 'pageSize ' => 10 ,
89
- 'currentPage ' => 1
90
- ];
91
-
92
86
$ product1Query = $ this ->getProductQuery ($ firstProductSku );
93
87
$ product2Query =$ this ->getProductQuery ($ secondProductSku );
94
88
$ categoryQuery = $ this ->getCategoryQuery ();
95
89
96
90
// cache-debug header value should be a MISS when category is loaded first time
97
- $ responseMissOnCategoryQuery = $ this ->graphQlQueryWithResponseHeaders ($ categoryQuery, [ $ categoryQueryVariables ] );
98
- $ cacheId = $ responseMissOnCategoryQuery ['headers ' ][CacheIdCalculator::CACHE_ID_HEADER ];
91
+ $ responseMissOnCategoryQuery = $ this ->graphQlQueryWithResponseHeaders ($ categoryQuery );
92
+ $ cacheId = $ responseMissOnCategoryQuery ['headers ' ][CacheIdCalculator::CACHE_ID_HEADER ];;
99
93
// Verify we obtain a cache MISS the first time we search the cache using this X-Magento-Cache-Id
100
94
$ this ->assertCacheMissAndReturnResponse ($ categoryQuery , [CacheIdCalculator::CACHE_ID_HEADER => $ cacheId ]);
101
95
@@ -112,10 +106,7 @@ public function testCacheTagForCategoriesWithProduct()
112
106
$ productRepository ->save ($ firstProduct );
113
107
114
108
// cache-debug header value should be MISS after updating product1 and reloading the Category
115
- $ responseMissCategoryAfterUpdate = $ this ->graphQlQueryWithResponseHeaders (
116
- $ categoryQuery ,
117
- [$ categoryQueryVariables ]
118
- );
109
+ $ responseMissCategoryAfterUpdate = $ this ->graphQlQueryWithResponseHeaders ($ categoryQuery );
119
110
$ this ->assertArrayHasKey (CacheIdCalculator::CACHE_ID_HEADER , $ responseMissCategoryAfterUpdate ['headers ' ]);
120
111
$ cacheId = $ responseMissCategoryAfterUpdate ['headers ' ][CacheIdCalculator::CACHE_ID_HEADER ];
121
112
// Verify we obtain a cache MISS the first time we search the cache using this X-Magento-Cache-Id
@@ -166,14 +157,18 @@ private function getProductQuery(string $productSku): string
166
157
*/
167
158
private function getCategoryQuery (): string
168
159
{
160
+ $ categoryId = 4 ;
161
+ $ pageSize = 10 ;
162
+ $ currentPage = 1 ;
163
+
169
164
$ categoryQueryString = <<<QUERY
170
- query GetCategoryQuery( \$ id: Int!, \$ pageSize: Int!, \$ currentPage: Int!) {
171
- category(id: \$ id ) {
165
+ query {
166
+ category(id: $ categoryId ) {
172
167
id
173
168
description
174
169
name
175
170
product_count
176
- products(pageSize: \ $pageSize, currentPage: \ $currentPage) {
171
+ products(pageSize: $ pageSize, currentPage: $ currentPage) {
177
172
items {
178
173
id
179
174
name
0 commit comments