You are here

function BlockAdminThemeTest::testAdminTheme 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::testAdminTheme()

Check for the accessibility of the admin theme on the block admin page.

File

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

Class

BlockAdminThemeTest
Tests the block system with admin themes.

Namespace

Drupal\block\Tests

Code

function testAdminTheme() {

  // Create administrative user.
  $admin_user = $this
    ->drupalCreateUser(array(
    '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/bartik');
  $this
    ->assertResponse(403);

  // Install admin theme and confirm that tab is accessible.
  \Drupal::service('theme_handler')
    ->install(array(
    'bartik',
  ));
  $edit['admin_theme'] = 'bartik';
  $this
    ->drupalPostForm('admin/appearance', $edit, t('Save configuration'));
  $this
    ->drupalGet('admin/structure/block/list/bartik');
  $this
    ->assertResponse(200);
}