function ResourceTestBase::getExpectedCacheContexts
Same name in other branches
- 9 core/modules/jsonapi/tests/src/Functional/ResourceTestBase.php \Drupal\Tests\jsonapi\Functional\ResourceTestBase::getExpectedCacheContexts()
- 10 core/modules/jsonapi/tests/src/Functional/ResourceTestBase.php \Drupal\Tests\jsonapi\Functional\ResourceTestBase::getExpectedCacheContexts()
- 11.x core/modules/jsonapi/tests/src/Functional/ResourceTestBase.php \Drupal\Tests\jsonapi\Functional\ResourceTestBase::getExpectedCacheContexts()
The expected cache contexts for the GET/HEAD response of the test entity.
Parameters
array|null $sparse_fieldset: If a sparse fieldset is being requested, limit the expected cache contexts for this entity's fields to just these fields.
Return value
string[] A set of cache contexts.
See also
::testGetIndividual()
13 calls to ResourceTestBase::getExpectedCacheContexts()
- BlockContentTest::getExpectedCacheContexts in core/
modules/ jsonapi/ tests/ src/ Functional/ BlockContentTest.php - The expected cache contexts for the GET/HEAD response of the test entity.
- BlockTest::getExpectedCacheContexts in core/
modules/ jsonapi/ tests/ src/ Functional/ BlockTest.php - The expected cache contexts for the GET/HEAD response of the test entity.
- CommentTest::getExpectedCacheContexts in core/
modules/ jsonapi/ tests/ src/ Functional/ CommentTest.php - The expected cache contexts for the GET/HEAD response of the test entity.
- ConfigurableLanguageTest::getExpectedCacheContexts in core/
modules/ jsonapi/ tests/ src/ Functional/ ConfigurableLanguageTest.php - The expected cache contexts for the GET/HEAD response of the test entity.
- ContentLanguageSettingsTest::getExpectedCacheContexts in core/
modules/ jsonapi/ tests/ src/ Functional/ ContentLanguageSettingsTest.php - The expected cache contexts for the GET/HEAD response of the test entity.
7 methods override ResourceTestBase::getExpectedCacheContexts()
- BlockContentTest::getExpectedCacheContexts in core/
modules/ jsonapi/ tests/ src/ Functional/ BlockContentTest.php - The expected cache contexts for the GET/HEAD response of the test entity.
- BlockTest::getExpectedCacheContexts in core/
modules/ jsonapi/ tests/ src/ Functional/ BlockTest.php - The expected cache contexts for the GET/HEAD response of the test entity.
- CommentTest::getExpectedCacheContexts in core/
modules/ jsonapi/ tests/ src/ Functional/ CommentTest.php - The expected cache contexts for the GET/HEAD response of the test entity.
- ConfigurableLanguageTest::getExpectedCacheContexts in core/
modules/ jsonapi/ tests/ src/ Functional/ ConfigurableLanguageTest.php - The expected cache contexts for the GET/HEAD response of the test entity.
- ContentLanguageSettingsTest::getExpectedCacheContexts in core/
modules/ jsonapi/ tests/ src/ Functional/ ContentLanguageSettingsTest.php - The expected cache contexts for the GET/HEAD response of the test entity.
File
-
core/
modules/ jsonapi/ tests/ src/ Functional/ ResourceTestBase.php, line 516
Class
- ResourceTestBase
- Subclass this for every JSON:API resource type.
Namespace
Drupal\Tests\jsonapi\FunctionalCode
protected function getExpectedCacheContexts(array $sparse_fieldset = NULL) {
$cache_contexts = [
// Cache contexts for JSON:API URL query parameters.
'url.query_args:fields',
'url.query_args:include',
// Drupal defaults.
'url.site',
'user.permissions',
];
$entity_type = $this->entity
->getEntityType();
return Cache::mergeContexts($cache_contexts, $entity_type->isRevisionable() ? [
'url.query_args:resourceVersion',
] : []);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.