protected function BlockUiTest::setUp in Drupal 9
Same name and namespace in other branches
- 8 core/modules/block/tests/src/Functional/BlockUiTest.php \Drupal\Tests\block\Functional\BlockUiTest::setUp()
Overrides BrowserTestBase::setUp
File
- core/
modules/ block/ tests/ src/ Functional/ BlockUiTest.php, line 57
Class
- BlockUiTest
- Tests that the block configuration UI exists and stores data correctly.
Namespace
Drupal\Tests\block\FunctionalCode
protected function setUp() : void {
parent::setUp();
// Create and log in an administrative user.
$this->adminUser = $this
->drupalCreateUser([
'administer blocks',
'access administration pages',
]);
$this
->drupalLogin($this->adminUser);
// Enable some test blocks.
$this->blockValues = [
[
'label' => 'Tools',
'tr' => '5',
'plugin_id' => 'system_menu_block:tools',
'settings' => [
'region' => 'sidebar_second',
'id' => 'tools',
],
'test_weight' => '-1',
],
[
'label' => 'Powered by Drupal',
'tr' => '16',
'plugin_id' => 'system_powered_by_block',
'settings' => [
'region' => 'footer',
'id' => 'powered',
],
'test_weight' => '0',
],
];
$this->blocks = [];
foreach ($this->blockValues as $values) {
$this->blocks[] = $this
->drupalPlaceBlock($values['plugin_id'], $values['settings']);
}
}