public function BlockViewBuilderTest::testBlockViewBuilderCache in Drupal 10
Same name and namespace in other branches
- 8 core/modules/block/tests/src/Kernel/BlockViewBuilderTest.php \Drupal\Tests\block\Kernel\BlockViewBuilderTest::testBlockViewBuilderCache()
- 9 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();
}