function HookCollectorPassTest::testHookRemove
Same name and namespace in other branches
- 11.x core/tests/Drupal/KernelTests/Core/Hook/HookCollectorPassTest.php \Drupal\KernelTests\Core\Hook\HookCollectorPassTest::testHookRemove()
Tests hook remove.
File
-
core/
tests/ Drupal/ KernelTests/ Core/ Hook/ HookCollectorPassTest.php, line 276
Class
Namespace
Drupal\KernelTests\Core\HookCode
public function testHookRemove() : void {
$module_installer = $this->container
->get('module_installer');
$this->assertTrue($module_installer->install([
'hook_test_remove',
]));
$module_handler = $this->container
->get('module_handler');
// There are two hooks implementing custom_hook1.
// One is removed with RemoveHook so it should not run.
$expected_calls = [
'Drupal\\hook_test_remove\\Hook\\TestHookRemove::hookDoRun',
];
$calls = $module_handler->invokeAll('custom_hook1');
$this->assertEquals($expected_calls, $calls);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.