By alexpott on
Change record status:
Published (View all published change records)
Project:
Introduced in branch:
11.3.x
Introduced in version:
11.3.0
Issue links:
Description:
Kernel tests can declare hook implementations to add hook testing. For example if you want to test hook_node_create() you can add the following method to your kernel test class:
/**
* Implements hook_ENTITY_TYPE_create() for node entities.
*/
#[Hook('node_create')]
public function nodeCreate(): void {
// Some logic.
}
Note that hooks declared in Kernel tests do not support the hook ordering / removal capabilities.
Impacts:
Module developers