You are here

protected function EntityCacheTagsTestBase::createCacheId in Zircon Profile 8.0

Same name and namespace in other branches
  1. 8 core/modules/system/src/Tests/Entity/EntityCacheTagsTestBase.php \Drupal\system\Tests\Entity\EntityCacheTagsTestBase::createCacheId()

Creates a cache ID from a list of cache keys and a set of cache contexts.

Parameters

string[] $keys: A list of cache keys.

string[] $contexts: A set of cache contexts.

Return value

string The cache ID string.

4 calls to EntityCacheTagsTestBase::createCacheId()
BlockContentCacheTagsTest::testBlock in core/modules/block_content/src/Tests/BlockContentCacheTagsTest.php
Tests that the block is cached with the correct contexts and tags.
EntityCacheTagsTestBase::testReferencedEntity in core/modules/system/src/Tests/Entity/EntityCacheTagsTestBase.php
Tests cache tags presence and invalidation of the entity when referenced.
EntityCacheTagsTestBase::verifyRenderCache in core/modules/system/src/Tests/Entity/EntityCacheTagsTestBase.php
Verify that a given render cache entry exists, with the correct cache tags.
EntityWithUriCacheTagsTestBase::testEntityUri in core/modules/system/src/Tests/Entity/EntityWithUriCacheTagsTestBase.php
Tests cache tags presence and invalidation of the entity at its URI.

File

core/modules/system/src/Tests/Entity/EntityCacheTagsTestBase.php, line 665
Contains \Drupal\system\Tests\Entity\EntityCacheTagsTestBase.

Class

EntityCacheTagsTestBase
Provides helper methods for Entity cache tags tests.

Namespace

Drupal\system\Tests\Entity

Code

protected function createCacheId(array $keys, array $contexts) {
  $cid_parts = $keys;
  $contexts = \Drupal::service('cache_contexts_manager')
    ->convertTokensToKeys($contexts);
  $cid_parts = array_merge($cid_parts, $contexts
    ->getKeys());
  return implode(':', $cid_parts);
}