function EntityWithUriCacheTagsTestBase::getDefaultCacheContexts

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

Gets the default cache contexts for rendered entities.

Return value

array The default cache contexts for rendered entities.

1 call to EntityWithUriCacheTagsTestBase::getDefaultCacheContexts()
EntityWithUriCacheTagsTestBase::testEntityUri in core/modules/system/tests/src/Functional/Entity/EntityWithUriCacheTagsTestBase.php
Tests cache tags presence and invalidation of the entity at its URI.
1 method overrides EntityWithUriCacheTagsTestBase::getDefaultCacheContexts()
CommentCacheTagsTest::getDefaultCacheContexts in core/modules/comment/tests/src/Functional/CommentCacheTagsTest.php
Gets the default cache contexts for rendered entities.

File

core/modules/system/tests/src/Functional/Entity/EntityWithUriCacheTagsTestBase.php, line 136

Class

EntityWithUriCacheTagsTestBase
Provides helper methods for Entity cache tags tests; for entities with URIs.

Namespace

Drupal\Tests\system\Functional\Entity

Code

protected function getDefaultCacheContexts() {
    // For url.site, see
    // \Drupal\Core\Entity\Controller\EntityViewController::view().
    return [
        'languages:' . LanguageInterface::TYPE_INTERFACE,
        'theme',
        'user.permissions',
        'url.site',
    ];
}

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