Test the theme callback when the site is in maintenance mode.
function testThemeCallbackMaintenanceMode() {
config('system.maintenance')
->set('enabled', 1)
->save();
theme_enable(array(
$this->admin_theme,
));
// 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.");
config('system.maintenance')
->set('enabled', 0)
->save();
}