public function ThemeSuggestionsAlterTest::testTemplateSuggestions in Drupal 9
Same name and namespace in other branches
- 8 core/modules/system/tests/src/Functional/Theme/ThemeSuggestionsAlterTest.php \Drupal\Tests\system\Functional\Theme\ThemeSuggestionsAlterTest::testTemplateSuggestions()
Tests that hooks to provide theme suggestions work.
File
- core/
modules/ system/ tests/ src/ Functional/ Theme/ ThemeSuggestionsAlterTest.php, line 35
Class
- ThemeSuggestionsAlterTest
- Tests theme suggestion alter hooks.
Namespace
Drupal\Tests\system\Functional\ThemeCode
public function testTemplateSuggestions() {
$this
->drupalGet('theme-test/suggestion-provided');
$this
->assertSession()
->pageTextContains('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
->assertSession()
->pageTextContains('Template overridden based on suggestion provided by the module declaring the theme hook.');
}