Change record status: 
Project: 
Introduced in branch: 
10.2.x
Introduced in version: 
10.2.0
Description: 

EntityCacheTagsTestBase used to manually create the cache ID (based on cache contexts) where it expected to find a render cache entry.

Given how RenderCache now leverages VariationCache and no longer manually creates cache IDs, you should no longer be constructing cache IDs yourself either. Instead, you can simply have your test provide the cache keys and cacheable metadata and the underlying VariationCache will construct the right ID and query the cache with it.

Before

    $cache_keys = ['entity_view', 'entity_test', $this->referencingEntity->id(), 'full'];
    $cid = $this->createCacheId($cache_keys, $entity_cache_contexts);
    $this->verifyRenderCache($cid, $referencing_entity_cache_tags);

After

    $cache_keys = ['entity_view', 'entity_test', $this->referencingEntity->id(), 'full'];
    $this->verifyRenderCache($cache_keys, $referencing_entity_cache_tags, (new CacheableMetadata())->setCacheContexts($entity_cache_contexts));
Impacts: 
Module developers