File tree Expand file tree Collapse file tree 1 file changed +25
-0
lines changed
dev/tests/api-functional/testsuite/Magento/GraphQl/Catalog/ResolverCache Expand file tree Collapse file tree 1 file changed +25
-0
lines changed Original file line number Diff line number Diff line change @@ -310,6 +310,31 @@ public function testMediaGalleryResolverCacheKeyAndTags()
310
310
$ this ->assertNotEquals ($ simpleProductCacheTags , $ simpleProductWithMediaCacheTags );
311
311
}
312
312
313
+ /**
314
+ * @magentoApiDataFixture Magento/Catalog/_files/product_with_media_gallery.php
315
+ * @return void
316
+ */
317
+ public function testCacheIsInvalidatedOnProductDeletion ()
318
+ {
319
+ $ product = $ this ->productRepository ->get ('simple_product_with_media ' );
320
+ $ query = $ this ->getProductWithMediaGalleryQuery ($ product );
321
+ $ this ->graphQlQuery ($ query );
322
+ $ this ->assertMediaGalleryResolverCacheRecordExists ($ product );
323
+
324
+ $ registry = $ this ->objectManager ->get (\Magento \Framework \Registry::class);
325
+ /** @var ProductRepositoryInterface $productRepository */
326
+ $ registry ->unregister ('isSecureArea ' );
327
+ $ registry ->register ('isSecureArea ' , true );
328
+
329
+ $ this ->productRepository ->delete ($ product );
330
+
331
+ $ registry ->unregister ('isSecureArea ' );
332
+ $ registry ->register ('isSecureArea ' , false );
333
+
334
+ // assert cache is invalidated
335
+ $ this ->assertMediaGalleryResolverCacheRecordDoesNotExist ($ product );
336
+ }
337
+
313
338
/**
314
339
* Assert that media gallery cache record exists for the $product.
315
340
*
You can’t perform that action at this time.
0 commit comments