public function ThemeSuggestionsAlterTest::testSuggestionsAlterInclude in Zircon Profile 8
Same name and namespace in other branches
- 8.0 core/modules/system/src/Tests/Theme/ThemeSuggestionsAlterTest.php \Drupal\system\Tests\Theme\ThemeSuggestionsAlterTest::testSuggestionsAlterInclude()
Tests that theme suggestion alter hooks work with theme hook includes.
File
- core/
modules/ system/ src/ Tests/ Theme/ ThemeSuggestionsAlterTest.php, line 143 - Contains \Drupal\system\Tests\Theme\ThemeSuggestionsAlterTest.
Class
- ThemeSuggestionsAlterTest
- Tests theme suggestion alter hooks.
Namespace
Drupal\system\Tests\ThemeCode
public function testSuggestionsAlterInclude() {
// Check the original theme output.
$this
->drupalGet('theme-test/suggestion-alter-include');
$this
->assertText('Original function before altering theme suggestions.');
// Enable theme_suggestions_test module and make two requests to make sure
// the include file is always loaded. The file will always be included for
// the first request because the theme registry is being rebuilt.
\Drupal::service('module_installer')
->install(array(
'theme_suggestions_test',
));
$this
->resetAll();
$this
->drupalGet('theme-test/suggestion-alter-include');
$this
->assertText('Function suggested via suggestion alter hook found in include file.', 'Include file loaded for initial request.');
$this
->drupalGet('theme-test/suggestion-alter-include');
$this
->assertText('Function suggested via suggestion alter hook found in include file.', 'Include file loaded for second request.');
}