BlockAdminThemeTest.php 1.29 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12
<?php

/**
 * @file
 * Definition of Drupal\block\Tests\BlockAdminThemeTest.
 */

namespace Drupal\block\Tests;

use Drupal\simpletest\WebTestBase;

/**
13
 * Tests the block system with admin themes.
14 15
 */
class BlockAdminThemeTest extends WebTestBase {
16 17 18 19 20 21 22 23

  /**
   * Modules to enable.
   *
   * @var array
   */
  public static $modules = array('block');

24 25
  public static function getInfo() {
    return array(
26 27
      'name' => 'Administration theme',
      'description' => 'Tests the block system with admin themes.',
28 29 30 31 32 33 34 35 36 37 38 39 40
      'group' => 'Block',
    );
  }

  /**
   * Check for the accessibility of the admin theme on the  block admin page.
   */
  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.
41
    $this->drupalGet('admin/structure/block/list/bartik');
42
    $this->assertResponse(403);
43 44

    // Enable admin theme and confirm that tab is accessible.
45
    theme_enable(array('bartik'));
46
    $edit['admin_theme'] = 'bartik';
47
    $this->drupalPostForm('admin/appearance', $edit, t('Save configuration'));
48
    $this->drupalGet('admin/structure/block/list/bartik');
49
    $this->assertResponse(200);
50 51
  }
}