You are here

protected function MenuRouterTest::doTestThemeCallbackOptionalTheme in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/modules/system/src/Tests/Menu/MenuRouterTest.php \Drupal\system\Tests\Menu\MenuRouterTest::doTestThemeCallbackOptionalTheme()

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

1 call to MenuRouterTest::doTestThemeCallbackOptionalTheme()
MenuRouterTest::testThemeIntegration in core/modules/system/src/Tests/Menu/MenuRouterTest.php
Tests theme integration.

File

core/modules/system/src/Tests/Menu/MenuRouterTest.php, line 302
Contains \Drupal\system\Tests\Menu\MenuRouterTest.

Class

MenuRouterTest
Tests menu router and default menu link functionality.

Namespace

Drupal\system\Tests\Menu

Code

protected function doTestThemeCallbackOptionalTheme() {

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

  // Now install the theme and request it again.
  $theme_handler = $this->container
    ->get('theme_handler');
  $theme_handler
    ->install(array(
    'test_theme',
  ));
  $this
    ->drupalGet('menu-test/theme-callback/use-test-theme');
  $this
    ->assertText('Active theme: test_theme. Actual theme: test_theme.', 'The theme negotiation system uses an optional theme once it has been installed.');
  $this
    ->assertRaw('test_theme/kitten.css', "The optional theme's CSS appears on the page.");
  $theme_handler
    ->uninstall(array(
    'test_theme',
  ));
}