MenuRouterTestCase::testThemeCallbackMaintenanceMode

7 menu.test MenuRouterTestCase::testThemeCallbackMaintenanceMode()
8 menu.test MenuRouterTestCase::testThemeCallbackMaintenanceMode()

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

File

modules/simpletest/tests/menu.test, line 205
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('bartik/css/style.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('Custom 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."));
}
Login or register to post comments