@@ -99,9 +99,9 @@ public function testCacheTagForCategoriesWithProduct()
99
99
print_r ("======= " );
100
100
print_r ($ responseMissOnCategoryQuery );
101
101
print_r (" end ======= " );
102
- $ this -> assertArrayHasKey (CacheIdCalculator:: CACHE_ID_HEADER , $ responseMissOnCategoryQuery ['headers ' ]) ;
103
- $ this -> assertArrayHasKey ( ' X-Magento-Cache-Debug ' , $ responseMissOnCategoryQuery [ ' headers ' ]);
104
- $ this ->assertEquals ( ' MISS ' , $ responseMissOnCategoryQuery [ ' headers ' ][ ' X-Magento-Cache-Debug ' ]);
102
+ $ cacheId = $ responseMissOnCategoryQuery ['headers ' ][CacheIdCalculator:: CACHE_ID_HEADER ] ;
103
+ // Verify we obtain a cache MISS the first time we search the cache using this X-Magento-Cache-Id
104
+ $ this ->assertCacheMissAndReturnResponse ( $ categoryQuery , [CacheIdCalculator:: CACHE_ID_HEADER => $ cacheId ]);
105
105
106
106
// Cache-debug header should be a MISS for product 1 on first request
107
107
$ responseFirstProduct = $ this ->graphQlQueryWithResponseHeaders ($ product1Query );
@@ -121,9 +121,10 @@ public function testCacheTagForCategoriesWithProduct()
121
121
$ categoryQueryVariables
122
122
);
123
123
$ this ->assertArrayHasKey (CacheIdCalculator::CACHE_ID_HEADER , $ responseMissCategoryAfterUpdate ['headers ' ]);
124
- $ this ->assertArrayHasKey ('X-Magento-Cache-Debug ' , $ responseMissOnCategoryQuery ['headers ' ]);
125
- $ this ->assertEquals ('MISS ' , $ responseMissOnCategoryQuery ['headers ' ]['X-Magento-Cache-Debug ' ]);
126
-
124
+ $ cacheId = $ responseMissCategoryAfterUpdate ['headers ' ][CacheIdCalculator::CACHE_ID_HEADER ];
125
+ // Verify we obtain a cache MISS the first time we search the cache using this X-Magento-Cache-Id
126
+ $ this ->assertCacheMissAndReturnResponse ($ categoryQuery , [$ categoryQueryVariables , CacheIdCalculator::CACHE_ID_HEADER => $ cacheId ]);
127
+
127
128
// cache-debug should be a MISS for product 1 after it is updated - cache invalidation
128
129
$ responseMissFirstProductAfterUpdate = $ this ->graphQlQueryWithResponseHeaders ($ product1Query );
129
130
$ cacheId = $ responseMissFirstProductAfterUpdate ['headers ' ][CacheIdCalculator::CACHE_ID_HEADER ];
0 commit comments