You are here

protected function EntityCacheTagsTestBase::createCacheId in Drupal 8

Same name in this branch
  1. 8 core/modules/system/src/Tests/Entity/EntityCacheTagsTestBase.php \Drupal\system\Tests\Entity\EntityCacheTagsTestBase::createCacheId()
  2. 8 core/modules/system/tests/src/Functional/Entity/EntityCacheTagsTestBase.php \Drupal\Tests\system\Functional\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.

3 calls to EntityCacheTagsTestBase::createCacheId()
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 667

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