function ResourceTestBase::getExpectedCacheTags

Same name and namespace in other branches
  1. 9 core/modules/jsonapi/tests/src/Functional/ResourceTestBase.php \Drupal\Tests\jsonapi\Functional\ResourceTestBase::getExpectedCacheTags()
  2. 10 core/modules/jsonapi/tests/src/Functional/ResourceTestBase.php \Drupal\Tests\jsonapi\Functional\ResourceTestBase::getExpectedCacheTags()
  3. 11.x 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()

9 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.
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.
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.

... See full list

4 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.
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 497

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());
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.