function MenuRouterTestCase::testThemeCallbackOptionalTheme

Test the theme callback when it is set to use an optional theme.

File

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

Class

MenuRouterTestCase

Code

function testThemeCallbackOptionalTheme() {

  // Request a theme that is not enabled.
  $this
    ->drupalGet('menu-test/theme-callback/use-stark-theme');
  $this
    ->assertText('Custom theme: NONE. Actual theme: bartik.', 'The theme callback system falls back on the default theme when a theme that is not enabled is requested.');
  $this
    ->assertRaw('bartik/css/style.css', "The default theme's CSS appears on the page.");

  // Now enable the theme and request it again.
  theme_enable(array(
    'stark',
  ));
  $this
    ->drupalGet('menu-test/theme-callback/use-stark-theme');
  $this
    ->assertText('Custom theme: stark. Actual theme: stark.', 'The theme callback system uses an optional theme once it has been enabled.');
  $this
    ->assertRaw('stark/layout.css', "The optional theme's CSS appears on the page.");
}