function BlockViewBuilderTest::setUp
Same name in other branches
- 9 core/modules/block/tests/src/Kernel/BlockViewBuilderTest.php \Drupal\Tests\block\Kernel\BlockViewBuilderTest::setUp()
- 8.9.x core/modules/block/tests/src/Kernel/BlockViewBuilderTest.php \Drupal\Tests\block\Kernel\BlockViewBuilderTest::setUp()
- 11.x 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 50
Class
- BlockViewBuilderTest
- Tests the block view builder.
Namespace
Drupal\Tests\block\KernelCode
protected function setUp() : void {
parent::setUp();
$this->container
->get('theme_installer')
->install([
'stark',
]);
$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');
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.