File tree Expand file tree Collapse file tree 1 file changed +29
-0
lines changed
dev/tests/api-functional/testsuite/Magento/CmsGraphQl/Model/Resolver Expand file tree Collapse file tree 1 file changed +29
-0
lines changed Original file line number Diff line number Diff line change 1111use Magento \Cms \Model \Page as CmsPage ;
1212use Magento \Cms \Model \PageRepository ;
1313use Magento \Framework \Api \SearchCriteriaBuilder ;
14+ use Magento \Framework \App \Cache \Frontend \Factory as CacheFrontendFactory ;
1415use Magento \Framework \App \Cache \StateInterface as CacheState ;
1516use Magento \Framework \ObjectManagerInterface ;
1617use Magento \GraphQlCache \Model \Cache \Query \Resolver \Result \Type as GraphQlCache ;
@@ -395,6 +396,34 @@ public function testCmsPageResolverCacheDoesNotSaveNonExistentCmsPage()
395396 );
396397 }
397398
399+ /**
400+ * Test that resolver cache is saved with default TTL
401+ *
402+ * @magentoDataFixture Magento/Cms/Fixtures/page_list.php
403+ * @return void
404+ */
405+ public function testCacheExpirationTimeUsesDefaultDirective ()
406+ {
407+ $ page = $ this ->getPageByTitle ('Page with 1column layout ' );
408+ $ query = $ this ->getQuery ($ page ->getIdentifier ());
409+ $ response = $ this ->graphQlQueryWithResponseHeaders (
410+ $ query
411+ );
412+
413+ $ cacheIdentityString = $ this ->getResolverCacheKeyFromResponseAndPage (
414+ $ response ,
415+ $ page
416+ );
417+
418+ $ lowLevelFrontendCache = $ this ->graphqlCache ->getLowLevelFrontend ();
419+ $ metadatas = $ lowLevelFrontendCache ->getMetadatas ($ cacheIdentityString );
420+
421+ $ this ->assertEquals (
422+ $ metadatas ['mtime ' ] + CacheFrontendFactory::DEFAULT_LIFETIME ,
423+ $ metadatas ['expire ' ]
424+ );
425+ }
426+
398427 private function generateExpectedDataFromPage (PageInterface $ page ): array
399428 {
400429 return [
You can’t perform that action at this time.
0 commit comments