Skip to content

Commit 726c84d

Browse files
committed
LYNX-232: Fix varnish test
1 parent 047ea14 commit 726c84d

File tree

1 file changed

+7
-0
lines changed
  • dev/tests/api-functional/testsuite/Magento/GraphQl/PageCache

1 file changed

+7
-0
lines changed

dev/tests/api-functional/testsuite/Magento/GraphQl/PageCache/VarnishTest.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -215,13 +215,20 @@ public function testCacheResultForCustomer()
215215
);
216216
$customerToken = $tokenResponse['body']['generateCustomerToken']['token'];
217217

218+
// Obtain the X-Magento-Cache-Id from the response
219+
$productResponse = $this->graphQlQueryWithResponseHeaders($query);
220+
$this->assertArrayHasKey(CacheIdCalculator::CACHE_ID_HEADER, $productResponse['headers']);
221+
$cacheIdForProducts = $productResponse['headers'][CacheIdCalculator::CACHE_ID_HEADER];
222+
218223
// Verify we obtain cache MISS the first time we search by this X-Magento-Cache-Id
219224
$this->assertCacheMissAndReturnResponse($query, [
225+
CacheIdCalculator::CACHE_ID_HEADER => $cacheIdForProducts,
220226
'Authorization' => 'Bearer ' . $customerToken
221227
]);
222228

223229
// Verify we obtain cache HIT second time using the same X-Magento-Cache-Id
224230
$this->assertCacheHitAndReturnResponse($query, [
231+
CacheIdCalculator::CACHE_ID_HEADER => $cacheIdForProducts,
225232
'Authorization' => 'Bearer ' . $customerToken
226233
]);
227234
$revokeTokenQuery = $this->revokeCustomerToken();

0 commit comments

Comments
 (0)