You are here

protected function BlockViewBuilderTest::setUp in Drupal 10

Same name and namespace in other branches
  1. 8 core/modules/block/tests/src/Kernel/BlockViewBuilderTest.php \Drupal\Tests\block\Kernel\BlockViewBuilderTest::setUp()
  2. 9 core/modules/block/tests/src/Kernel/BlockViewBuilderTest.php \Drupal\Tests\block\Kernel\BlockViewBuilderTest::setUp()

File

core/modules/block/tests/src/Kernel/BlockViewBuilderTest.php, line 49

Class

BlockViewBuilderTest
Tests the block view builder.

Namespace

Drupal\Tests\block\Kernel

Code

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');
}