You are here

protected function ResourceTestBase::getExpectedCacheContexts in JSON:API 8

Same name and namespace in other branches
  1. 8.2 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()

10 calls to ResourceTestBase::getExpectedCacheContexts()
BlockContentTest::getExpectedCacheContexts in tests/src/Functional/BlockContentTest.php
The expected cache contexts for the GET/HEAD response of the test entity.
BlockTest::getExpectedCacheContexts in tests/src/Functional/BlockTest.php
The expected cache contexts for the GET/HEAD response of the test entity.
CommentTest::getExpectedCacheContexts in tests/src/Functional/CommentTest.php
The expected cache contexts for the GET/HEAD response of the test entity.
ConfigurableLanguageTest::getExpectedCacheContexts in tests/src/Functional/ConfigurableLanguageTest.php
The expected cache contexts for the GET/HEAD response of the test entity.
ContentLanguageSettingsTest::getExpectedCacheContexts in tests/src/Functional/ContentLanguageSettingsTest.php
The expected cache contexts for the GET/HEAD response of the test entity.

... See full list

6 methods override ResourceTestBase::getExpectedCacheContexts()
BlockContentTest::getExpectedCacheContexts in tests/src/Functional/BlockContentTest.php
The expected cache contexts for the GET/HEAD response of the test entity.
BlockTest::getExpectedCacheContexts in tests/src/Functional/BlockTest.php
The expected cache contexts for the GET/HEAD response of the test entity.
CommentTest::getExpectedCacheContexts in tests/src/Functional/CommentTest.php
The expected cache contexts for the GET/HEAD response of the test entity.
ConfigurableLanguageTest::getExpectedCacheContexts in tests/src/Functional/ConfigurableLanguageTest.php
The expected cache contexts for the GET/HEAD response of the test entity.
ContentLanguageSettingsTest::getExpectedCacheContexts in tests/src/Functional/ContentLanguageSettingsTest.php
The expected cache contexts for the GET/HEAD response of the test entity.

... See full list

File

tests/src/Functional/ResourceTestBase.php, line 452

Class

ResourceTestBase
Subclass this for every JSON API resource type.

Namespace

Drupal\Tests\jsonapi\Functional

Code

protected function getExpectedCacheContexts(array $sparse_fieldset = NULL) {
  return [
    // Cache contexts for JSON API URL query parameters.
    'url.query_args:fields',
    'url.query_args:filter',
    'url.query_args:include',
    'url.query_args:page',
    'url.query_args:sort',
    // Drupal defaults.
    'url.site',
    'user.permissions',
  ];
}