You are here

protected function EntityResourceTestBase::getExpectedCacheContexts in Drupal 10

Same name and namespace in other branches
  1. 8 core/modules/rest/tests/src/Functional/EntityResource/EntityResourceTestBase.php \Drupal\Tests\rest\Functional\EntityResource\EntityResourceTestBase::getExpectedCacheContexts()
  2. 9 core/modules/rest/tests/src/Functional/EntityResource/EntityResourceTestBase.php \Drupal\Tests\rest\Functional\EntityResource\EntityResourceTestBase::getExpectedCacheContexts()

The expected cache contexts for the GET/HEAD response of the test entity.

Return value

string[]

See also

::testGet

1 call to EntityResourceTestBase::getExpectedCacheContexts()
EntityResourceTestBase::testGet in core/modules/rest/tests/src/Functional/EntityResource/EntityResourceTestBase.php
Tests a GET request for an entity, plus edge cases to ensure good DX.
9 methods override EntityResourceTestBase::getExpectedCacheContexts()
BlockContentResourceTestBase::getExpectedCacheContexts in core/modules/block_content/tests/src/Functional/Rest/BlockContentResourceTestBase.php
The expected cache contexts for the GET/HEAD response of the test entity.
EditorResourceTestBase::getExpectedCacheContexts in core/modules/editor/tests/src/Functional/Rest/EditorResourceTestBase.php
The expected cache contexts for the GET/HEAD response of the test entity.
EntityTestLabelResourceTestBase::getExpectedCacheContexts in core/modules/system/tests/modules/entity_test/tests/src/Functional/Rest/EntityTestLabelResourceTestBase.php
The expected cache contexts for the GET/HEAD response of the test entity.
EntityTestMapFieldResourceTestBase::getExpectedCacheContexts in core/modules/system/tests/modules/entity_test/tests/src/Functional/Rest/EntityTestMapFieldResourceTestBase.php
The expected cache contexts for the GET/HEAD response of the test entity.
FieldConfigResourceTestBase::getExpectedCacheContexts in core/modules/field/tests/src/Functional/Rest/FieldConfigResourceTestBase.php
The expected cache contexts for the GET/HEAD response of the test entity.

... See full list

File

core/modules/rest/tests/src/Functional/EntityResource/EntityResourceTestBase.php, line 394

Class

EntityResourceTestBase
Even though there is the generic EntityResource, it's necessary for every entity type to have its own test, because they each have different fields, validation constraints, et cetera. It's not because the generic case works, that every case…

Namespace

Drupal\Tests\rest\Functional\EntityResource

Code

protected function getExpectedCacheContexts() {
  return [
    'url.site',
    'user.permissions',
  ];
}