function BlockViewBuilderTest::testBlockViewBuilderCache
Same name in other branches
- 8.9.x core/modules/block/tests/src/Kernel/BlockViewBuilderTest.php \Drupal\Tests\block\Kernel\BlockViewBuilderTest::testBlockViewBuilderCache()
- 10 core/modules/block/tests/src/Kernel/BlockViewBuilderTest.php \Drupal\Tests\block\Kernel\BlockViewBuilderTest::testBlockViewBuilderCache()
- 11.x core/modules/block/tests/src/Kernel/BlockViewBuilderTest.php \Drupal\Tests\block\Kernel\BlockViewBuilderTest::testBlockViewBuilderCache()
Tests block render cache handling.
File
-
core/
modules/ block/ tests/ src/ Kernel/ BlockViewBuilderTest.php, line 127
Class
- BlockViewBuilderTest
- Tests the block view builder.
Namespace
Drupal\Tests\block\KernelCode
public function testBlockViewBuilderCache() {
// Verify cache handling for a non-empty block.
$this->verifyRenderCacheHandling();
// Create an empty block.
$this->block = $this->controller
->create([
'id' => 'test_block',
'theme' => 'stark',
'plugin' => 'test_cache',
]);
$this->block
->save();
\Drupal::state()->set('block_test.content', NULL);
// Verify cache handling for an empty block.
$this->verifyRenderCacheHandling();
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.