function BlockTemplateSuggestionsTest::setUp

Same name and namespace in other branches
  1. 11.x core/modules/block_content/tests/src/Kernel/BlockTemplateSuggestionsTest.php \Drupal\Tests\block_content\Kernel\BlockTemplateSuggestionsTest::setUp()

Overrides KernelTestBase::setUp

File

core/modules/block_content/tests/src/Kernel/BlockTemplateSuggestionsTest.php, line 39

Class

BlockTemplateSuggestionsTest
Tests the block_content_theme_suggestions_block() function.

Namespace

Drupal\Tests\block_content\Kernel

Code

protected function setUp() : void {
  parent::setUp();
  $this->installEntitySchema('block_content');
  // Create a block content type.
  $block_content_type = BlockContentType::create([
    'id' => 'test_block',
    'label' => 'A test block type',
    'description' => "Provides a test block type.",
  ]);
  $block_content_type->save();
  $this->blockContent = BlockContent::create([
    'info' => 'The Test Block',
    'type' => 'test_block',
  ]);
  $this->blockContent
    ->save();
}

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