// Verify a cache hit, but also the presence of the correct cache tags.
$expected_tags = Cache::
mergeTags($referencing_entity_cache_tags,
$page_cache_tags);
$expected_tags = Cache::
mergeTags($expected_tags,
$page_cache_tags_referencing_entity);
$this->
verifyPageCache($listing_url, 'HIT',
$expected_tags);
// Prime the page cache for the empty listing.
$this->
verifyPageCache($empty_entity_listing_url, 'MISS'
);
// Verify a cache hit, but also the presence of the correct cache tags.
$this->
verifyPageCache($empty_entity_listing_url, 'HIT',
$empty_entity_listing_cache_tags);
// Verify the entity type's list cache contexts are present.
$contexts_in_header =
$this->
getSession()->
getResponseHeader('X-Drupal-Cache-Contexts'
);
$this->
assertEqualsCanonicalizing(Cache::
mergeContexts($page_cache_contexts,
$this->
getAdditionalCacheContextsForEntityListing()),
empty($contexts_in_header) ?
[] :
explode(' ',
$contexts_in_header));
// Prime the page cache for the listing containing the referenced entity.
$this->
verifyPageCache($nonempty_entity_listing_url, 'MISS',
$nonempty_entity_listing_cache_tags);
// Verify a cache hit, but also the presence of the correct cache tags.
$this->
verifyPageCache($nonempty_entity_listing_url, 'HIT',
$nonempty_entity_listing_cache_tags);
// Verify the entity type's list cache contexts are present.
$contexts_in_header =
$this->
getSession()->
getResponseHeader('X-Drupal-Cache-Contexts'
);
$this->
assertEqualsCanonicalizing(Cache::
mergeContexts($page_cache_contexts,
$this->
getAdditionalCacheContextsForEntityListing()),
empty($contexts_in_header) ?
[] :
explode(' ',
$contexts_in_header));
// Verify that after modifying the referenced entity, there is a cache miss
// for every route except the one for the non-referencing entity.