function MenuRouterTest::testThemeCallbackOptionalTheme

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

File

drupal/core/modules/system/lib/Drupal/system/Tests/Menu/MenuRouterTest.php, line 218
Definition of Drupal\system\Tests\Menu\MenuRouterTest.

Class

MenuRouterTest
Tests menu router and hook_menu() functionality.

Namespace

Drupal\system\Tests\Menu

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(
    $this->alternate_theme,
  ));
  $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/css/layout.css', "The optional theme's CSS appears on the page.");
}