function EntityResourceTestBase::getExpectedCacheTags

Same name and namespace in other branches
  1. 9 core/modules/rest/tests/src/Functional/EntityResource/EntityResourceTestBase.php \Drupal\Tests\rest\Functional\EntityResource\EntityResourceTestBase::getExpectedCacheTags()
  2. 8.9.x core/modules/rest/tests/src/Functional/EntityResource/EntityResourceTestBase.php \Drupal\Tests\rest\Functional\EntityResource\EntityResourceTestBase::getExpectedCacheTags()
  3. 10 core/modules/rest/tests/src/Functional/EntityResource/EntityResourceTestBase.php \Drupal\Tests\rest\Functional\EntityResource\EntityResourceTestBase::getExpectedCacheTags()

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

Return value

string[]

See also

::testGet

10 calls to EntityResourceTestBase::getExpectedCacheTags()
BlockContentResourceTestBase::getExpectedCacheTags in core/modules/block_content/tests/src/Functional/Rest/BlockContentResourceTestBase.php
The expected cache tags for the GET/HEAD response of the test entity.
BlockResourceTestBase::getExpectedCacheTags in core/modules/block/tests/src/Functional/Rest/BlockResourceTestBase.php
The expected cache tags for the GET/HEAD response of the test entity.
CommentResourceTestBase::getExpectedCacheTags in core/modules/comment/tests/src/Functional/Rest/CommentResourceTestBase.php
The expected cache tags for the GET/HEAD response of the test entity.
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.
EntityTestComputedFieldNormalizerTest::getExpectedCacheTags in core/modules/system/tests/modules/entity_test/tests/src/Functional/Rest/EntityTestComputedFieldNormalizerTest.php
The expected cache tags for the GET/HEAD response of the test entity.

... See full list

8 methods override EntityResourceTestBase::getExpectedCacheTags()
BlockContentResourceTestBase::getExpectedCacheTags in core/modules/block_content/tests/src/Functional/Rest/BlockContentResourceTestBase.php
The expected cache tags for the GET/HEAD response of the test entity.
BlockResourceTestBase::getExpectedCacheTags in core/modules/block/tests/src/Functional/Rest/BlockResourceTestBase.php
The expected cache tags for the GET/HEAD response of the test entity.
CommentResourceTestBase::getExpectedCacheTags in core/modules/comment/tests/src/Functional/Rest/CommentResourceTestBase.php
The expected cache tags for the GET/HEAD response of the test entity.
EntityTestComputedFieldNormalizerTest::getExpectedCacheTags in core/modules/system/tests/modules/entity_test/tests/src/Functional/Rest/EntityTestComputedFieldNormalizerTest.php
The expected cache tags for the GET/HEAD response of the test entity.
EntityTestJsonInternalPropertyNormalizerTest::getExpectedCacheTags in core/modules/system/tests/modules/entity_test/tests/src/Functional/Rest/EntityTestJsonInternalPropertyNormalizerTest.php
The expected cache tags for the GET/HEAD response of the test entity.

... See full list

File

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

Class

EntityResourceTestBase
Defines a base class for testing all entity resources.

Namespace

Drupal\Tests\rest\Functional\EntityResource

Code

protected function getExpectedCacheTags() {
    $expected_cache_tags = [
        'config:rest.resource.entity.' . static::$entityTypeId,
    ];
    if (!static::$auth) {
        $expected_cache_tags[] = 'config:user.role.anonymous';
    }
    $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.