public function ThemeLegacyTest::testThemeFunctionSuggestionsAlter in Drupal 8
Same name and namespace in other branches
- 9 core/modules/system/tests/src/Functional/Theme/ThemeLegacyTest.php \Drupal\Tests\system\Functional\Theme\ThemeLegacyTest::testThemeFunctionSuggestionsAlter()
Tests that theme suggestion alter hooks work for theme functions.
File
- core/
modules/ system/ tests/ src/ Functional/ Theme/ ThemeLegacyTest.php, line 45
Class
- ThemeLegacyTest
- Tests legacy theme functions.
Namespace
Drupal\Tests\system\Functional\ThemeCode
public function testThemeFunctionSuggestionsAlter() {
$this
->drupalGet('theme-test/function-suggestion-alter');
$this
->assertText('Original theme function.');
// Install test_theme and test that themes can alter theme suggestions.
$this
->config('system.theme')
->set('default', 'test_legacy_theme')
->save();
$this
->drupalGet('theme-test/function-suggestion-alter');
$this
->assertText('Theme function overridden based on new theme suggestion provided by the test_legacy_theme theme.');
// Enable the theme_suggestions_test module to test modules implementing
// suggestions alter hooks.
\Drupal::service('module_installer')
->install([
'theme_legacy_suggestions_test',
]);
$this
->resetAll();
$this
->drupalGet('theme-test/function-suggestion-alter');
$this
->assertText('Theme function overridden based on new theme suggestion provided by a module.');
}