function RouterTest::testThemeCallbackHookCustomTheme

Test that the theme callback wins out over hook_custom_theme().

File

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

Class

RouterTest
Tests menu router and hook_menu() functionality.

Namespace

Drupal\system\Tests\Menu

Code

function testThemeCallbackHookCustomTheme() {

  // Trigger hook_custom_theme() to dynamically request the Stark theme for
  // the requested page.
  state()
    ->set('menu_test.hook_custom_theme_name', 'stark');
  theme_enable(array(
    'stark',
    'seven',
  ));

  // The menu "theme callback" should take precedence over a value set in
  // hook_custom_theme().
  $this
    ->drupalGet('menu-test/theme-callback/use-admin-theme');
  $this
    ->assertText('Custom theme: seven. Actual theme: seven.', 'The result of hook_custom_theme() does not override what was set in a theme callback.');
  $this
    ->assertRaw('seven/style.css', "The Seven theme's CSS appears on the page.");
}