function ResourceTestBase::generateDynamicPageCacheExpectedHeaderValue
Generates an X-Drupal-Dynamic-Cache header value based on cacheability.
Parameters
array $cache_context: Cache context.
int|null $cache_max_age: (optional) Cache max age.
Return value
'UNCACHEABLE (poor cacheability)'|'MISS' The X-Drupal-Dynamic-Cache header value.
8 calls to ResourceTestBase::generateDynamicPageCacheExpectedHeaderValue()
- ResourceTestBase::assertResourceResponse in core/
modules/ jsonapi/ tests/ src/ Functional/ ResourceTestBase.php  - Asserts that a resource response has the given status code and body.
 - ResourceTestBase::doTestIncluded in core/
modules/ jsonapi/ tests/ src/ Functional/ ResourceTestBase.php  - Tests included resources.
 - ResourceTestBase::doTestRelated in core/
modules/ jsonapi/ tests/ src/ Functional/ ResourceTestBase.php  - Performs one round of related route testing.
 - ResourceTestBase::doTestRelationshipGet in core/
modules/ jsonapi/ tests/ src/ Functional/ ResourceTestBase.php  - Performs one round of relationship route testing.
 - ResourceTestBase::doTestSparseFieldSets in core/
modules/ jsonapi/ tests/ src/ Functional/ ResourceTestBase.php  - Tests sparse field sets.
 
File
- 
              core/
modules/ jsonapi/ tests/ src/ Functional/ ResourceTestBase.php, line 3648  
Class
- ResourceTestBase
 - Subclass this for every JSON:API resource type.
 
Namespace
Drupal\Tests\jsonapi\FunctionalCode
protected function generateDynamicPageCacheExpectedHeaderValue(array $cache_context, ?int $cache_max_age = NULL) : string {
  // MISS or UNCACHEABLE (poor cacheability) depends on data.
  // It must not be HIT.
  return $cache_max_age === 0 || !empty(array_intersect([
    'user',
    'session',
  ], $cache_context)) ? 'UNCACHEABLE (poor cacheability)' : 'MISS';
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.