@@ -320,6 +320,52 @@ public function testCmsPageResolverCacheInvalidatesWhenPageGetsDeleted()
320320 );
321321 }
322322
323+ /**
324+ * @magentoConfigFixture default/system/full_page_cache/caching_application 2
325+ * @magentoDataFixture Magento/Cms/Fixtures/page_list.php
326+ * @return void
327+ */
328+ public function testCmsPageResolverCacheInvalidatesWhenPageGetsDisabled ()
329+ {
330+ // cache page1
331+ $ page1 = $ this ->getPageByTitle ('Page with 1column layout ' );
332+
333+ $ query = $ this ->getQuery ($ page1 ->getIdentifier ());
334+ $ response = $ this ->graphQlQueryWithResponseHeaders ($ query );
335+
336+ $ cacheIdentityStringPage1 = $ this ->getResolverCacheKeyFromResponseAndPage ($ response , $ page1 );
337+
338+ $ this ->assertIsNumeric (
339+ $ this ->graphqlCache ->test ($ cacheIdentityStringPage1 )
340+ );
341+
342+ // cache page2
343+ $ page2 = $ this ->getPageByTitle ('Page with unavailable layout ' );
344+
345+ $ query = $ this ->getQuery ($ page2 ->getIdentifier ());
346+ $ response = $ this ->graphQlQueryWithResponseHeaders ($ query );
347+
348+ $ cacheIdentityStringPage2 = $ this ->getResolverCacheKeyFromResponseAndPage ($ response , $ page2 );
349+
350+ $ this ->assertIsNumeric (
351+ $ this ->graphqlCache ->test ($ cacheIdentityStringPage2 )
352+ );
353+
354+ // disable page 1
355+ $ page1 ->setIsActive (false );
356+ $ this ->pageRepository ->save ($ page1 );
357+
358+ $ this ->assertFalse (
359+ $ this ->graphqlCache ->test ($ cacheIdentityStringPage1 ),
360+ 'Cache entry still exists for disabled CMS page '
361+ );
362+
363+ // assert page2 cache entry still exists
364+ $ this ->assertIsNumeric (
365+ $ this ->graphqlCache ->test ($ cacheIdentityStringPage2 )
366+ );
367+ }
368+
323369 private function generateExpectedDataFromPage (PageInterface $ page ): array
324370 {
325371 return [
0 commit comments