function BlockContentCacheTest::testBlockContentBlockCacheData
Tests the cache tags for BlockContentBlock.
File
-
core/
modules/ block_content/ tests/ src/ Kernel/ BlockContentCacheTest.php, line 42
Class
- BlockContentCacheTest
- Tests cache metadata for BlockContentBlock plugin.
Namespace
Drupal\Tests\block_content\KernelCode
public function testBlockContentBlockCacheData() : void {
$block_content = $this->createBlockContent('Cache test');
$block = Block::create([
'plugin' => 'block_content' . PluginBase::DERIVATIVE_SEPARATOR . $block_content->uuid(),
'region' => 'content',
'id' => 'cache_test',
'theme' => 'stark',
]);
$plugin = $block->getPlugin();
$this->assertCount(0, \array_diff($block_content->getCacheContexts(), $plugin->getCacheContexts()));
$this->assertSame($block_content->getCacheMaxAge(), $plugin->getCacheMaxAge());
$this->assertCount(0, \array_diff($block_content->getCacheTags(), $plugin->getCacheTags()));
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.