function ThemeHookTest::testLegacyHookInThemes

Tests that procedural hooks with #[LegacyHook] are properly ignored.

File

core/modules/system/tests/src/Kernel/Theme/ThemeHookTest.php, line 40

Class

ThemeHookTest
Tests low-level theme functions.

Namespace

Drupal\Tests\system\Kernel\Theme

Code

public function testLegacyHookInThemes() : void {
  $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.