Skip to content

Commit f75a6a5

Browse files
committed
B2B-2530: Unskip GraphQL cache tests skipped due to DEVOPS-4924
- Adding webapi fixes
1 parent 49a4dd0 commit f75a6a5

File tree

1 file changed

+10
-15
lines changed

1 file changed

+10
-15
lines changed

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

Lines changed: 10 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -83,19 +83,13 @@ public function testCacheTagForCategoriesWithProduct()
8383
$firstProduct = $productRepository->get($firstProductSku, false, null, true);
8484
$productRepository->get($secondProductSku, false, null, true);
8585

86-
$categoryQueryVariables =[
87-
'id' => $categoryId,
88-
'pageSize'=> 10,
89-
'currentPage' => 1
90-
];
91-
9286
$product1Query = $this->getProductQuery($firstProductSku);
9387
$product2Query =$this->getProductQuery($secondProductSku);
9488
$categoryQuery = $this->getCategoryQuery();
9589

9690
// 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];;
9993
// Verify we obtain a cache MISS the first time we search the cache using this X-Magento-Cache-Id
10094
$this->assertCacheMissAndReturnResponse($categoryQuery, [CacheIdCalculator::CACHE_ID_HEADER => $cacheId]);
10195

@@ -112,10 +106,7 @@ public function testCacheTagForCategoriesWithProduct()
112106
$productRepository->save($firstProduct);
113107

114108
// 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);
119110
$this->assertArrayHasKey(CacheIdCalculator::CACHE_ID_HEADER, $responseMissCategoryAfterUpdate['headers']);
120111
$cacheId = $responseMissCategoryAfterUpdate['headers'][CacheIdCalculator::CACHE_ID_HEADER];
121112
// 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
166157
*/
167158
private function getCategoryQuery(): string
168159
{
160+
$categoryId = 4;
161+
$pageSize = 10;
162+
$currentPage = 1;
163+
169164
$categoryQueryString = <<<QUERY
170-
query GetCategoryQuery(\$id: Int!, \$pageSize: Int!, \$currentPage: Int!) {
171-
category(id: \$id) {
165+
query {
166+
category(id: $categoryId) {
172167
id
173168
description
174169
name
175170
product_count
176-
products(pageSize: \$pageSize, currentPage: \$currentPage) {
171+
products(pageSize: $pageSize, currentPage: $currentPage) {
177172
items {
178173
id
179174
name

0 commit comments

Comments
 (0)