You are here

class BlockAdminThemeTest in MongoDB 7

Test the MongoDB block UI with admin themes.

Hierarchy

  • class \Drupal\mongodb_block_ui\Tests\BlockAdminThemeTest extends \Drupal\mongodb_block_ui\Tests\DrupalWebTestCase

Expanded class hierarchy of BlockAdminThemeTest

File

mongodb_block_ui/src/Tests/BlockAdminThemeTest.php, line 8

Namespace

Drupal\mongodb_block_ui\Tests
View source
class BlockAdminThemeTest extends \DrupalWebTestCase {

  /**
   * Name the test.
   */
  public static function getInfo() {
    return array(
      'name' => 'Admin theme block admin accessibility',
      'description' => "Check whether the block administer page for a disabled theme acccessible if and only if it's the admin theme.",
      'group' => 'MongoDB: Block',
    );
  }

  /**
   * Check for the accessibility of the admin theme on the  block admin page.
   */
  public function testAdminTheme() {

    // Create administrative user.
    $adminuser = $this
      ->drupalCreateUser(array(
      'administer blocks',
      'administer themes',
    ));
    $this
      ->drupalLogin($adminuser);

    // Ensure that access to block admin page is denied when theme is disabled.
    $this
      ->drupalGet('admin/structure/block/list/stark');
    $this
      ->assertResponse(403, t('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, t('The block admin page for the admin theme can be accessed'));
  }

}

Members

Namesort descending Modifiers Type Description Overrides
BlockAdminThemeTest::getInfo public static function Name the test.
BlockAdminThemeTest::testAdminTheme public function Check for the accessibility of the admin theme on the block admin page.