You are here

public function BlockAdminThemeTest::testAdminTheme in MongoDB 7

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

File

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

Class

BlockAdminThemeTest
Test the MongoDB block UI with admin themes.

Namespace

Drupal\mongodb_block_ui\Tests

Code

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'));
}