You are here

protected function ResourceTestBase::getExpectedCacheTags in Drupal 9

Same name and namespace in other branches
  1. 8 core/modules/jsonapi/tests/src/Functional/ResourceTestBase.php \Drupal\Tests\jsonapi\Functional\ResourceTestBase::getExpectedCacheTags()

The expected cache tags 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 tags for this entity's fields to just these fields.

Return value

string[] A set of cache tags.

See also

::testGetIndividual()

8 calls to ResourceTestBase::getExpectedCacheTags()
BlockContentTest::getExpectedCacheTags in core/modules/jsonapi/tests/src/Functional/BlockContentTest.php
The expected cache tags for the GET/HEAD response of the test entity.
CommentTest::getExpectedCacheTags in core/modules/jsonapi/tests/src/Functional/CommentTest.php
The expected cache tags for the GET/HEAD response of the test entity.
NodeTest::testGetIndividual in core/modules/jsonapi/tests/src/Functional/NodeTest.php
Tests GETting an individual resource, plus edge cases to ensure good DX.
ResourceTestBase::doTestSparseFieldSets in core/modules/jsonapi/tests/src/Functional/ResourceTestBase.php
Tests sparse field sets.
ResourceTestBase::getExpectedGetIndividualResourceResponse in core/modules/jsonapi/tests/src/Functional/ResourceTestBase.php
Gets the expected individual ResourceResponse for GET.

... See full list

5 methods override ResourceTestBase::getExpectedCacheTags()
BlockContentTest::getExpectedCacheTags in core/modules/jsonapi/tests/src/Functional/BlockContentTest.php
The expected cache tags for the GET/HEAD response of the test entity.
BlockTest::getExpectedCacheTags in core/modules/jsonapi/tests/src/Functional/BlockTest.php
The expected cache tags for the GET/HEAD response of the test entity.
CommentTest::getExpectedCacheTags in core/modules/jsonapi/tests/src/Functional/CommentTest.php
The expected cache tags for the GET/HEAD response of the test entity.
EntityTestComputedFieldTest::getExpectedCacheTags in core/modules/jsonapi/tests/src/Functional/EntityTestComputedFieldTest.php
The expected cache tags for the GET/HEAD response of the test entity.
TermTest::getExpectedCacheTags in core/modules/jsonapi/tests/src/Functional/TermTest.php
The expected cache tags for the GET/HEAD response of the test entity.

File

core/modules/jsonapi/tests/src/Functional/ResourceTestBase.php, line 499

Class

ResourceTestBase
Subclass this for every JSON:API resource type.

Namespace

Drupal\Tests\jsonapi\Functional

Code

protected function getExpectedCacheTags(array $sparse_fieldset = NULL) {
  $expected_cache_tags = [
    'http_response',
  ];
  return Cache::mergeTags($expected_cache_tags, $this->entity
    ->getCacheTags());
}