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 11
11
use Magento \Cms \Model \Page as CmsPage ;
12
12
use Magento \Cms \Model \PageRepository ;
13
13
use Magento \Framework \Api \SearchCriteriaBuilder ;
14
+ use Magento \Framework \App \Cache \Frontend \Factory as CacheFrontendFactory ;
14
15
use Magento \Framework \App \Cache \StateInterface as CacheState ;
15
16
use Magento \Framework \ObjectManagerInterface ;
16
17
use Magento \GraphQlCache \Model \Cache \Query \Resolver \Result \Type as GraphQlCache ;
@@ -395,6 +396,34 @@ public function testCmsPageResolverCacheDoesNotSaveNonExistentCmsPage()
395
396
);
396
397
}
397
398
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
+
398
427
private function generateExpectedDataFromPage (PageInterface $ page ): array
399
428
{
400
429
return [
You can’t perform that action at this time.
0 commit comments