function BlockHtmlTest::setUp
Same name in other branches
- 9 core/modules/block/tests/src/Functional/BlockHtmlTest.php \Drupal\Tests\block\Functional\BlockHtmlTest::setUp()
- 8.9.x core/modules/block/tests/src/Functional/BlockHtmlTest.php \Drupal\Tests\block\Functional\BlockHtmlTest::setUp()
- 10 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 29
Class
- BlockHtmlTest
- Tests block HTML ID validity.
Namespace
Drupal\Tests\block\FunctionalCode
protected function setUp() : void {
parent::setUp();
$this->drupalLogin($this->drupalCreateUser([
'administer blocks',
'access administration pages',
]));
// 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', [
'id' => 'test_menu_block',
]);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.