function EntityCacheTagsTestBase::verifyRenderCache
Same name in other branches
- 9 core/modules/system/tests/src/Functional/Entity/EntityCacheTagsTestBase.php \Drupal\Tests\system\Functional\Entity\EntityCacheTagsTestBase::verifyRenderCache()
- 8.9.x core/modules/system/src/Tests/Entity/EntityCacheTagsTestBase.php \Drupal\system\Tests\Entity\EntityCacheTagsTestBase::verifyRenderCache()
- 8.9.x core/modules/system/tests/src/Functional/Entity/EntityCacheTagsTestBase.php \Drupal\Tests\system\Functional\Entity\EntityCacheTagsTestBase::verifyRenderCache()
- 11.x core/modules/system/tests/src/Functional/Entity/EntityCacheTagsTestBase.php \Drupal\Tests\system\Functional\Entity\EntityCacheTagsTestBase::verifyRenderCache()
Verify that a given render cache entry exists, with the correct cache tags.
Parameters
string[] $keys: The render cache item keys.
array $tags: An array of expected cache tags.
\Drupal\Core\Cache\CacheableDependencyInterface $cacheability: The initial cacheability the item was rendered with.
4 calls to EntityCacheTagsTestBase::verifyRenderCache()
- BlockContentCacheTagsTest::testBlock in core/
modules/ block_content/ tests/ src/ Functional/ BlockContentCacheTagsTest.php - Tests that the block is cached with the correct contexts and tags.
- EntityCacheTagsTestBase::testReferencedEntity in core/
modules/ system/ tests/ src/ Functional/ Entity/ EntityCacheTagsTestBase.php - Tests cache tags presence and invalidation of the entity when referenced.
- EntityWithUriCacheTagsTestBase::testEntityUri in core/
modules/ system/ tests/ src/ Functional/ Entity/ EntityWithUriCacheTagsTestBase.php - Tests cache tags presence and invalidation of the entity at its URI.
- ShortcutCacheTagsTest::testEntityCreation in core/
modules/ shortcut/ tests/ src/ Functional/ ShortcutCacheTagsTest.php - Tests that when creating a shortcut, the shortcut set tag is invalidated.
File
-
core/
modules/ system/ tests/ src/ Functional/ Entity/ EntityCacheTagsTestBase.php, line 647
Class
- EntityCacheTagsTestBase
- Provides helper methods for Entity cache tags tests.
Namespace
Drupal\Tests\system\Functional\EntityCode
protected function verifyRenderCache(array $keys, array $tags, CacheableDependencyInterface $cacheability) {
$cache_bin = $this->getRenderCacheBackend();
// Also verify the existence of an entity render cache entry.
$cache_entry = $cache_bin->get($keys, $cacheability);
$this->assertInstanceOf(\stdClass::class, $cache_entry);
sort($cache_entry->tags);
sort($tags);
$this->assertSame($cache_entry->tags, $tags);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.