You are here

function BlockAdminThemeTestCase::testAdminTheme in Drupal 7

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

File

modules/block/block.test, line 468
Tests for block.module.

Class

BlockAdminThemeTestCase
Test the block system with admin themes.

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 disabled.
  $this
    ->drupalGet('admin/structure/block/list/stark');
  $this
    ->assertResponse(403, 'The block admin page for a disabled theme can not be accessed');

  // Enable admin theme and confirm that tab is accessible.
  $edit['admin_theme'] = 'stark';
  $this
    ->drupalPost('admin/appearance', $edit, t('Save configuration'));
  $this
    ->drupalGet('admin/structure/block/list/stark');
  $this
    ->assertResponse(200, 'The block admin page for the admin theme can be accessed');
}