function EntityCacheTagsTestBase::getAdditionalCacheContextsForEntity

Same name in other branches
  1. 8.9.x core/modules/system/src/Tests/Entity/EntityCacheTagsTestBase.php \Drupal\system\Tests\Entity\EntityCacheTagsTestBase::getAdditionalCacheContextsForEntity()
  2. 8.9.x core/modules/system/tests/src/Functional/Entity/EntityCacheTagsTestBase.php \Drupal\Tests\system\Functional\Entity\EntityCacheTagsTestBase::getAdditionalCacheContextsForEntity()
  3. 10 core/modules/system/tests/src/Functional/Entity/EntityCacheTagsTestBase.php \Drupal\Tests\system\Functional\Entity\EntityCacheTagsTestBase::getAdditionalCacheContextsForEntity()
  4. 11.x core/modules/system/tests/src/Functional/Entity/EntityCacheTagsTestBase.php \Drupal\Tests\system\Functional\Entity\EntityCacheTagsTestBase::getAdditionalCacheContextsForEntity()

Returns the additional (non-standard) cache contexts for the tested entity.

Only list cache contexts that aren't part of the required cache contexts.

Parameters

\Drupal\Core\Entity\EntityInterface $entity: The entity to be tested, as created by createEntity().

Return value

string[] An array of the additional cache contexts.

See also

\Drupal\Tests\system\Functional\Entity\EntityCacheTagsTestBase::createEntity()

2 calls to EntityCacheTagsTestBase::getAdditionalCacheContextsForEntity()
EntityCacheTagsTestBase::testReferencedEntity in core/modules/system/tests/src/Functional/Entity/EntityCacheTagsTestBase.php
Tests cache tags presence and invalidation of the entity when referenced.
EntityWithUriCacheTagsTestBase::testEntityUri in core/modules/system/tests/src/Functional/Entity/EntityWithUriCacheTagsTestBase.php
Tests cache tags presence and invalidation of the entity at its URI.
3 methods override EntityCacheTagsTestBase::getAdditionalCacheContextsForEntity()
CommentCacheTagsTest::getAdditionalCacheContextsForEntity in core/modules/comment/tests/src/Functional/CommentCacheTagsTest.php
Returns the additional (non-standard) cache contexts for the tested entity.
MediaCacheTagsTest::getAdditionalCacheContextsForEntity in core/modules/media/tests/src/Functional/MediaCacheTagsTest.php
Returns the additional (non-standard) cache contexts for the tested entity.
NodeCacheTagsTest::getAdditionalCacheContextsForEntity in core/modules/node/tests/src/Functional/NodeCacheTagsTest.php
Returns the additional (non-standard) cache contexts for the tested entity.

File

core/modules/system/tests/src/Functional/Entity/EntityCacheTagsTestBase.php, line 158

Class

EntityCacheTagsTestBase
Provides helper methods for Entity cache tags tests.

Namespace

Drupal\Tests\system\Functional\Entity

Code

protected function getAdditionalCacheContextsForEntity(EntityInterface $entity) {
    return [];
}

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