function BlockAdminThemeTest::testClaroAdminTheme
Same name in other branches
- 9 core/modules/block/tests/src/Functional/BlockAdminThemeTest.php \Drupal\Tests\block\Functional\BlockAdminThemeTest::testClaroAdminTheme()
- 11.x core/modules/block/tests/src/Functional/BlockAdminThemeTest.php \Drupal\Tests\block\Functional\BlockAdminThemeTest::testClaroAdminTheme()
Ensure contextual links are disabled in Claro theme.
File
-
core/
modules/ block/ tests/ src/ Functional/ BlockAdminThemeTest.php, line 54
Class
- BlockAdminThemeTest
- Tests the block system with admin themes.
Namespace
Drupal\Tests\block\FunctionalCode
public function testClaroAdminTheme() : void {
// Create administrative user.
$admin_user = $this->drupalCreateUser([
'access administration pages',
'administer themes',
'access contextual links',
'view the administration theme',
]);
$this->drupalLogin($admin_user);
// Install admin theme and confirm that tab is accessible.
\Drupal::service('theme_installer')->install([
'claro',
]);
$edit['admin_theme'] = 'claro';
$this->drupalGet('admin/appearance');
$this->submitForm($edit, 'Save configuration');
// Define our block settings.
$settings = [
'theme' => 'claro',
'region' => 'header',
];
// Place a block.
$block = $this->drupalPlaceBlock('local_tasks_block', $settings);
// Open admin page.
$this->drupalGet('admin');
// Check if contextual link classes are unavailable.
$this->assertSession()
->responseNotContains('<div data-contextual-id="block:block=' . $block->id() . ':langcode=en"></div>');
$this->assertSession()
->responseNotContains('contextual-region');
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.