public function BlockAdminThemeTest::testAdminTheme in Drupal 10
Same name and namespace in other branches
- 8 core/modules/block/tests/src/Functional/BlockAdminThemeTest.php \Drupal\Tests\block\Functional\BlockAdminThemeTest::testAdminTheme()
- 9 core/modules/block/tests/src/Functional/BlockAdminThemeTest.php \Drupal\Tests\block\Functional\BlockAdminThemeTest::testAdminTheme()
Check for the accessibility of the admin theme on the block admin page.
File
- core/
modules/ block/ tests/ src/ Functional/ BlockAdminThemeTest.php, line 29
Class
- BlockAdminThemeTest
- Tests the block system with admin themes.
Namespace
Drupal\Tests\block\FunctionalCode
public function testAdminTheme() {
// Create administrative user.
$admin_user = $this
->drupalCreateUser([
'administer blocks',
'administer themes',
]);
$this
->drupalLogin($admin_user);
// Ensure that access to block admin page is denied when theme is not
// installed.
$this
->drupalGet('admin/structure/block/list/olivero');
$this
->assertSession()
->statusCodeEquals(403);
// Install admin theme and confirm that tab is accessible.
\Drupal::service('theme_installer')
->install([
'olivero',
]);
$edit['admin_theme'] = 'olivero';
$this
->drupalGet('admin/appearance');
$this
->submitForm($edit, 'Save configuration');
$this
->drupalGet('admin/structure/block/list/olivero');
$this
->assertSession()
->statusCodeEquals(200);
}