You are here

function BlockAdminThemeTest::testSevenAdminTheme in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/modules/block/src/Tests/BlockAdminThemeTest.php \Drupal\block\Tests\BlockAdminThemeTest::testSevenAdminTheme()

Ensure contextual links are disabled in Seven theme.

File

core/modules/block/src/Tests/BlockAdminThemeTest.php, line 50
Contains \Drupal\block\Tests\BlockAdminThemeTest.

Class

BlockAdminThemeTest
Tests the block system with admin themes.

Namespace

Drupal\block\Tests

Code

function testSevenAdminTheme() {

  // 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_handler')
    ->install([
    'seven',
  ]);
  $edit['admin_theme'] = 'seven';
  $this
    ->drupalPostForm('admin/appearance', $edit, t('Save configuration'));

  // Define our block settings.
  $settings = [
    'theme' => 'seven',
    '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
    ->assertNoRaw('<div data-contextual-id="block:block=' . $block
    ->id() . ':langcode=en"></div>');
  $this
    ->assertNoRaw('contextual-region');
}