protected function BlockViewBuilderTest::setUp in Drupal 9
Same name and namespace in other branches
- 8 core/modules/block/tests/src/Kernel/BlockViewBuilderTest.php \Drupal\Tests\block\Kernel\BlockViewBuilderTest::setUp()
Overrides KernelTestBase::setUp
File
- core/
modules/ block/ tests/ src/ Kernel/ BlockViewBuilderTest.php, line 49
Class
- BlockViewBuilderTest
- Tests the block view builder.
Namespace
Drupal\Tests\block\KernelCode
protected function setUp() : void {
parent::setUp();
$this->controller = $this->container
->get('entity_type.manager')
->getStorage('block');
\Drupal::state()
->set('block_test.content', 'Llamas > unicorns!');
// Create a block with only required values.
$this->block = $this->controller
->create([
'id' => 'test_block',
'theme' => 'stark',
'plugin' => 'test_cache',
]);
$this->block
->save();
$this->container
->get('cache.render')
->deleteAll();
$this->renderer = $this->container
->get('renderer');
}