You are here

function MenuIncTestCase::testThemeCallbackMaintenanceMode in SimpleTest 7

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

File

tests/menu.test, line 56
Provides SimpleTests for menu.inc.

Class

MenuIncTestCase
@file Provides SimpleTests for menu.inc.

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