function BlockViewBuilderTest::setUp

Same name in other branches
  1. 9 core/modules/block/tests/src/Kernel/BlockViewBuilderTest.php \Drupal\Tests\block\Kernel\BlockViewBuilderTest::setUp()
  2. 10 core/modules/block/tests/src/Kernel/BlockViewBuilderTest.php \Drupal\Tests\block\Kernel\BlockViewBuilderTest::setUp()
  3. 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 49

Class

BlockViewBuilderTest
Tests the block view builder.

Namespace

Drupal\Tests\block\Kernel

Code

protected function setUp() {
    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');
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.