function ThemeLegacyTest::testSuggestionsAlterInclude
Same name in other branches
- 8.9.x core/modules/system/tests/src/Functional/Theme/ThemeLegacyTest.php \Drupal\Tests\system\Functional\Theme\ThemeLegacyTest::testSuggestionsAlterInclude()
Tests that theme suggestion alter hooks work with theme hook includes.
File
-
core/
modules/ system/ tests/ src/ Functional/ Theme/ ThemeLegacyTest.php, line 70
Class
- ThemeLegacyTest
- Tests legacy theme functions.
Namespace
Drupal\Tests\system\Functional\ThemeCode
public function testSuggestionsAlterInclude() {
// Check the original theme output.
$this->drupalGet('theme-test/suggestion-alter-include');
$this->assertSession()
->pageTextContains('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([
'theme_legacy_suggestions_test',
]);
$this->resetAll();
$this->drupalGet('theme-test/suggestion-alter-include');
$this->assertSession()
->pageTextContains('Function suggested via suggestion alter hook found in include file.', 'Include file loaded for initial request.');
$this->drupalGet('theme-test/suggestion-alter-include');
$this->assertSession()
->pageTextContains('Function suggested via suggestion alter hook found in include file.', 'Include file loaded for second request.');
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.