You are here

function MenuRouterTestCase::testThemeCallbackMaintenanceMode in Drupal 7

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

File

modules/simpletest/tests/menu.test, line 205
Provides SimpleTests for menu.inc.

Class

MenuRouterTestCase

Code

function testThemeCallbackMaintenanceMode() {
  variable_set('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/style.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('Custom theme: seven. Actual theme: seven.', 'The theme callback system is correctly triggered for an administrator when the site is in maintenance mode.');
  $this
    ->assertRaw('seven/style.css', "The administrative theme's CSS appears on the page.");
}