You are here

function ThemeSuggestionsAlterTest::testTemplateSuggestions in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/modules/system/src/Tests/Theme/ThemeSuggestionsAlterTest.php \Drupal\system\Tests\Theme\ThemeSuggestionsAlterTest::testTemplateSuggestions()

Tests that hooks to provide theme suggestions work.

File

core/modules/system/src/Tests/Theme/ThemeSuggestionsAlterTest.php, line 35
Contains \Drupal\system\Tests\Theme\ThemeSuggestionsAlterTest.

Class

ThemeSuggestionsAlterTest
Tests theme suggestion alter hooks.

Namespace

Drupal\system\Tests\Theme

Code

function testTemplateSuggestions() {
  $this
    ->drupalGet('theme-test/suggestion-provided');
  $this
    ->assertText('Template for testing suggestions provided by the module declaring the theme hook.');

  // Install test_theme, it contains a template suggested by theme_test.module
  // in theme_test_theme_suggestions_theme_test_suggestion_provided().
  $this
    ->config('system.theme')
    ->set('default', 'test_theme')
    ->save();
  $this
    ->drupalGet('theme-test/suggestion-provided');
  $this
    ->assertText('Template overridden based on suggestion provided by the module declaring the theme hook.');
}