You are here

protected function MenuRouterTest::doTestThemeCallbackMaintenanceMode in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/modules/system/src/Tests/Menu/MenuRouterTest.php \Drupal\system\Tests\Menu\MenuRouterTest::doTestThemeCallbackMaintenanceMode()

Test the theme negotiation when the site is in maintenance mode.

1 call to MenuRouterTest::doTestThemeCallbackMaintenanceMode()
MenuRouterTest::testThemeIntegration in core/modules/system/src/Tests/Menu/MenuRouterTest.php
Tests theme integration.

File

core/modules/system/src/Tests/Menu/MenuRouterTest.php, line 281
Contains \Drupal\system\Tests\Menu\MenuRouterTest.

Class

MenuRouterTest
Tests menu router and default menu link functionality.

Namespace

Drupal\system\Tests\Menu

Code

protected function doTestThemeCallbackMaintenanceMode() {
  $this->container
    ->get('state')
    ->set('system.maintenance_mode', TRUE);

  // For a regular user, the fact that the site is in maintenance mode means
  // we expect the theme callback system to be bypassed entirely.
  $this
    ->drupalGet('menu-test/theme-callback/use-admin-theme');
  $this
    ->assertRaw('bartik/css/base/elements.css', "The maintenance theme's CSS appears on the page.");

  // An administrator, however, should continue to see the requested theme.
  $admin_user = $this
    ->drupalCreateUser(array(
    'access site in maintenance mode',
  ));
  $this
    ->drupalLogin($admin_user);
  $this
    ->drupalGet('menu-test/theme-callback/use-admin-theme');
  $this
    ->assertText('Active theme: seven. Actual theme: seven.', 'The theme negotiation system is correctly triggered for an administrator when the site is in maintenance mode.');
  $this
    ->assertRaw('seven/css/base/elements.css', "The administrative theme's CSS appears on the page.");
  $this->container
    ->get('state')
    ->set('system.maintenance_mode', FALSE);
}