Skip to content

Commit b00dc07

Browse files
committed
B2B-2677: [MediaGallery]Implement data caching for GraphQL results on resolver level
1 parent 58df76b commit b00dc07

File tree

2 files changed

+4
-18
lines changed

2 files changed

+4
-18
lines changed

app/code/Magento/CatalogGraphQl/Model/Resolver/Cache/Product/MediaGallery/ProductModelDehydrator.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ public function dehydrate(array &$resolvedValue): void
5555
}
5656

5757
/**
58-
* Dedydrate the resolved value of a media gallery entity.
58+
* Dehydrate the resolved value of a media gallery entity.
5959
*
6060
* @param array $mediaGalleryEntityResolvedValue
6161
* @return void

dev/tests/api-functional/testsuite/Magento/GraphQl/Catalog/ResolverCache/MediaGalleryTest.php

Lines changed: 3 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -50,23 +50,9 @@ protected function setUp(): void
5050
$this->graphQlResolverCache = $this->objectManager->get(GraphQlResolverCache::class);
5151
$this->productRepository = $this->objectManager->get(ProductRepositoryInterface::class);
5252

53-
// first register secure area so we have permission to delete customer in tests
54-
$this->registry = $this->objectManager->get(Registry::class);
55-
$this->registry->unregister('isSecureArea');
56-
$this->registry->register('isSecureArea', true);
57-
5853
parent::setUp();
5954
}
6055

61-
protected function tearDown(): void
62-
{
63-
// reset secure area to false (was set to true in setUp so we could delete customer in tests)
64-
$this->registry->unregister('isSecureArea');
65-
$this->registry->register('isSecureArea', false);
66-
67-
parent::tearDown();
68-
}
69-
7056
/**
7157
* @magentoDbIsolation disabled
7258
* @magentoApiDataFixture Magento/Catalog/_files/product_simple_with_media_gallery_entries.php
@@ -183,11 +169,11 @@ public function testMediaGalleryResolverCacheKeyAndTags()
183169

184170
$simpleProduct = $this->productRepository->get($simpleProductSku);
185171
$simpleProductCacheKey = $this->getCacheKeyForMediaGalleryResolver($simpleProduct);
186-
$simplePrductCacheTags = $this->getCacheTagsUsedInMediaGalleryResolverCache($simpleProductCacheKey);
172+
$simpleProductCacheTags = $this->getCacheTagsUsedInMediaGalleryResolverCache($simpleProductCacheKey);
187173
// Verify cache tags are generated correctly for the simple product
188174
$this->assertEquals(
189175
$this->getExpectedCacheTags($simpleProduct),
190-
$simplePrductCacheTags
176+
$simpleProductCacheTags
191177
);
192178

193179
// Test simple product with media
@@ -212,7 +198,7 @@ public function testMediaGalleryResolverCacheKeyAndTags()
212198
$this->assertNotEquals($simpleProductCacheKey, $simpleProductWithMediaCacheKey);
213199

214200
// Verify different product query has different cache tags
215-
$this->assertNotEquals($simplePrductCacheTags, $simpleProductWithMediaCacheTags);
201+
$this->assertNotEquals($simpleProductCacheTags, $simpleProductWithMediaCacheTags);
216202
}
217203

218204
/**

0 commit comments

Comments
 (0)