function ThemeHookTest::testLegacyHookInThemes
Same name and namespace in other branches
- 11.x core/modules/system/tests/src/Kernel/Theme/ThemeHookTest.php \Drupal\Tests\system\Kernel\Theme\ThemeHookTest::testLegacyHookInThemes()
Tests that procedural hooks with #[LegacyHook] are properly ignored.
Attributes
#[IgnoreDeprecations]
File
-
core/
modules/ system/ tests/ src/ Kernel/ Theme/ ThemeHookTest.php, line 43
Class
- ThemeHookTest
- Tests low-level theme functions.
Namespace
Drupal\Tests\system\Kernel\ThemeCode
public function testLegacyHookInThemes() : void {
$this->expectUserDeprecationMessage('Code in procedural_hook_theme.theme is deprecated in drupal:11.5.0 and must be converted before drupal:13.0.0. Use classes instead. See https://www.drupal.org/node/3581222');
$args = [];
\Drupal::theme()->alter('procedural_legacy', $args);
$this->assertEquals([
'OOP theme hook executed.',
], $args);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.