function ModuleHandlerTest::testInvokeWithMergeable
Same name and namespace in other branches
- main core/modules/system/tests/src/Kernel/Extension/ModuleHandlerTest.php \Drupal\Tests\system\Kernel\Extension\ModuleHandlerTest::testInvokeWithMergeable()
Tests invoke works for multiple implementations that can be merged.
File
-
core/
modules/ system/ tests/ src/ Kernel/ Extension/ ModuleHandlerTest.php, line 404
Class
- ModuleHandlerTest
- Tests ModuleHandler functionality.
Namespace
Drupal\Tests\system\Kernel\ExtensionCode
public function testInvokeWithMergeable() : void {
$this->moduleInstaller()
->install([
'hook_single_invoke',
]);
$expected = [
'Drupal\\hook_single_invoke\\Hook\\TestHookInvoke::hookInvokeSingleArrayOne',
'Drupal\\hook_single_invoke\\Hook\\TestHookInvoke::hookInvokeSingleArrayTwo',
];
$this->assertEquals($expected, $this->moduleHandler()
->invoke('hook_single_invoke', 'custom_hook_invoke_array', args: [
TRUE,
]));
$expected = [
'Drupal\\hook_single_invoke\\Hook\\TestHookInvoke::hookInvokeSingleArrayObjectOne',
'Drupal\\hook_single_invoke\\Hook\\TestHookInvoke::hookInvokeSingleArrayObjectTwo',
];
$this->assertEquals($expected, $this->moduleHandler()
->invoke('hook_single_invoke', 'custom_hook_invoke_array_object', args: [
TRUE,
]));
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.