You are here

protected function ResourceTestBase::getExpectedCacheTags in JSON:API 8

Same name and namespace in other branches
  1. 8.2 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 tests/src/Functional/BlockContentTest.php
The expected cache tags for the GET/HEAD response of the test entity.
BlockTest::getExpectedCacheTags in tests/src/Functional/BlockTest.php
The expected cache tags for the GET/HEAD response of the test entity.
CommentTest::getExpectedCacheTags in tests/src/Functional/CommentTest.php
The expected cache tags for the GET/HEAD response of the test entity.
NodeTest::testGetIndividual in tests/src/Functional/NodeTest.php
Tests GETting an individual resource, plus edge cases to ensure good DX.
ResourceTestBase::doTestSparseFieldSets in tests/src/Functional/ResourceTestBase.php
Tests sparse field sets.

... See full list

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

File

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

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