Skip to content

Commit 6ef2e01

Browse files
committed
B2B-2471: Defects in CatalogUrlResolverIdentity and CmsUrlResolverIdentity prevent caching
- Fix some static issues
1 parent d2bdf92 commit 6ef2e01

File tree

2 files changed

+24
-7
lines changed

2 files changed

+24
-7
lines changed

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

Lines changed: 20 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -365,7 +365,10 @@ public function testUrlRewriteCleansCacheOnChange(string $requestPath)
365365
// renaming entity request path and validating that API will not return cached response
366366
$urlRewrite->setRequestPath('test' . $requestPath);
367367
$urlRewriteResourceModel->save($urlRewrite);
368-
$apiResponse = $this->assertCacheMissAndReturnResponse($query($requestPath), [CacheIdCalculator::CACHE_ID_HEADER => $cacheId]);
368+
$apiResponse = $this->assertCacheMissAndReturnResponse(
369+
$query($requestPath),
370+
[CacheIdCalculator::CACHE_ID_HEADER => $cacheId]
371+
);
369372
$this->assertNull($apiResponse['body']['route']);
370373

371374
// rolling back changes
@@ -399,7 +402,6 @@ public function urlRewriteEntitiesDataProvider(): array
399402
*/
400403
public function testUrlRewriteCleansCacheForCustomRewrites()
401404
{
402-
403405
/** @var UrlRewriteResourceModel $urlRewriteResourceModel */
404406
$urlRewriteResourceModel = $this->objectManager->create(UrlRewriteResourceModel::class);
405407
$storeId = 1;
@@ -457,10 +459,16 @@ public function testUrlRewriteCleansCacheForCustomRewrites()
457459
$cacheId = $apiResponse['headers'][CacheIdCalculator::CACHE_ID_HEADER];
458460

459461
// Verify we obtain a cache MISS the first time we search the cache using this X-Magento-Cache-Id
460-
$this->assertCacheMissAndReturnResponse($query($customRequestPath), [CacheIdCalculator::CACHE_ID_HEADER => $cacheId]);
462+
$this->assertCacheMissAndReturnResponse(
463+
$query($customRequestPath),
464+
[CacheIdCalculator::CACHE_ID_HEADER => $cacheId]
465+
);
461466

462467
// Verify we obtain a cache HIT the second time around for this X-Magento-Cache-Id
463-
$this->assertCacheHitAndReturnResponse($query($customRequestPath), [CacheIdCalculator::CACHE_ID_HEADER => $cacheId]);
468+
$this->assertCacheHitAndReturnResponse(
469+
$query($customRequestPath),
470+
[CacheIdCalculator::CACHE_ID_HEADER => $cacheId]
471+
);
464472

465473
// confirm that API returns non-cached response for the second custom rewrite
466474
$apiResponse = $this->graphQlQueryWithResponseHeaders($query($customSecondRequestPath));
@@ -469,10 +477,16 @@ public function testUrlRewriteCleansCacheForCustomRewrites()
469477
$cacheId = $apiResponse['headers'][CacheIdCalculator::CACHE_ID_HEADER];
470478

471479
// Verify we obtain a cache MISS the first time we search the cache using this X-Magento-Cache-Id
472-
$this->assertCacheMissAndReturnResponse($query($customSecondRequestPath), [CacheIdCalculator::CACHE_ID_HEADER => $cacheId]);
480+
$this->assertCacheMissAndReturnResponse(
481+
$query($customSecondRequestPath),
482+
[CacheIdCalculator::CACHE_ID_HEADER => $cacheId]
483+
);
473484

474485
// Verify we obtain a cache HIT the second time around for this X-Magento-Cache-Id
475-
$this->assertCacheHitAndReturnResponse($query($customSecondRequestPath), [CacheIdCalculator::CACHE_ID_HEADER => $cacheId]);
486+
$this->assertCacheHitAndReturnResponse(
487+
$query($customSecondRequestPath),
488+
[CacheIdCalculator::CACHE_ID_HEADER => $cacheId]
489+
);
476490
}
477491

478492
$urlRewriteResourceModel->delete($secondUrlRewriteModel);

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

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,10 @@ public function testCacheResultForGuestWithCurrencyHeader()
105105
$defaultCurrencyCacheId = $response['headers'][CacheIdCalculator::CACHE_ID_HEADER];
106106

107107
// Verify we obtain a cache MISS the first time we search the cache using this X-Magento-Cache-Id
108-
$this->assertCacheMissAndReturnResponse($query, [CacheIdCalculator::CACHE_ID_HEADER => $defaultCurrencyCacheId]);
108+
$this->assertCacheMissAndReturnResponse(
109+
$query,
110+
[CacheIdCalculator::CACHE_ID_HEADER => $defaultCurrencyCacheId]
111+
);
109112
// Verify we obtain a cache HIT the second time we search the cache using this X-Magento-Cache-Id
110113
$this->assertCacheHitAndReturnResponse($query, [CacheIdCalculator::CACHE_ID_HEADER => $defaultCurrencyCacheId]);
111114

0 commit comments

Comments
 (0)