You are here

protected function BlockHtmlTest::setUp in Drupal 8

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

Overrides BrowserTestBase::setUp

File

core/modules/block/tests/src/Functional/BlockHtmlTest.php, line 26

Class

BlockHtmlTest
Tests block HTML ID validity.

Namespace

Drupal\Tests\block\Functional

Code

protected function setUp() {
  parent::setUp();
  $this
    ->drupalLogin($this->rootUser);

  // Enable the test_html block, to test HTML ID and attributes.
  \Drupal::state()
    ->set('block_test.attributes', [
    'data-custom-attribute' => 'foo',
  ]);
  \Drupal::state()
    ->set('block_test.content', $this
    ->randomMachineName());
  $this
    ->drupalPlaceBlock('test_html', [
    'id' => 'test_html_block',
  ]);

  // Enable a menu block, to test more complicated HTML.
  $this
    ->drupalPlaceBlock('system_menu_block:admin');
}