File tree Expand file tree Collapse file tree 1 file changed +38
-0
lines changed
dev/tests/api-functional/testsuite/Magento/CmsGraphQl/Model/Resolver Expand file tree Collapse file tree 1 file changed +38
-0
lines changed Original file line number Diff line number Diff line change @@ -167,6 +167,44 @@ public function testCmsBlockResolverCacheInvalidatesWhenBlockGetsDeleted()
167167 );
168168 }
169169
170+ /**
171+ * @magentoDataFixture Magento/Cms/_files/blocks.php
172+ */
173+ public function testCmsBlockResolverCacheInvalidatesWhenBlockGetsDisabled ()
174+ {
175+ $ block = $ this ->blockRepository ->getById ('enabled_block ' );
176+
177+ $ query = $ this ->getQuery ([
178+ $ block ->getIdentifier (),
179+ ]);
180+
181+ $ response = $ this ->graphQlQueryWithResponseHeaders ($ query );
182+
183+ $ cacheIdentityString = $ this ->getResolverCacheKeyFromResponseAndBlocks ($ response , [$ block ]);
184+
185+ $ cacheEntry = $ this ->graphqlCache ->load ($ cacheIdentityString );
186+ $ cacheEntryDecoded = json_decode ($ cacheEntry , true );
187+
188+ $ this ->assertEqualsCanonicalizing (
189+ $ this ->generateExpectedDataFromBlocks ([$ block ]),
190+ $ cacheEntryDecoded
191+ );
192+
193+ $ this ->assertTagsByCacheIdentityAndBlocks (
194+ $ cacheIdentityString ,
195+ [$ block ]
196+ );
197+
198+ // assert that cache is invalidated after block disablement
199+ $ block ->setIsActive (false );
200+ $ this ->blockRepository ->save ($ block );
201+
202+ $ this ->assertFalse (
203+ $ this ->graphqlCache ->test ($ cacheIdentityString ),
204+ 'Cache entry should be invalidated after block disablement '
205+ );
206+ }
207+
170208 /**
171209 * @magentoDataFixture Magento/Cms/_files/block.php
172210 * @magentoDataFixture Magento/Store/_files/second_store.php
You can’t perform that action at this time.
0 commit comments