function HookOrderTest::testBothParametersHookOrder
Same name and namespace in other branches
- 11.x core/tests/Drupal/KernelTests/Core/Hook/HookOrderTest.php \Drupal\KernelTests\Core\Hook\HookOrderTest::testBothParametersHookOrder()
Tests ordering of 'test_both_parameters_hook' with all parameters defined.
This tests when both $modules and $classesAndMethods are passed as parameters to OrderAfter.
The order of 'test_both_parameters_hook', without modification would be as follows.
- \Drupal\aaa_hook_order_test\Hook\AHooks::testBothParametersHook()
- \Drupal\bbb_hook_order_test\Hook\BHooks::testBothParametersHook()
- \Drupal\ccc_hook_order_test\Hook\CHooks::testBothParametersHook()
That order is modified in the hook implementation as follows, and the resulting order asserted in this test. The Order class is used to move:
- Drupal\aaa_hook_order_test\Hook\AHooks::testBothParametersHook() after module bbb_hook_order_test, and \Drupal\ccc_hook_order_test\Hook\CHooks::testBothParametersHook()
See also
\Drupal\aaa_hook_order_test\Hook\AHooks::testBothParametersHook()
\Drupal\bbb_hook_order_test\Hook\BHooks::testBothParametersHook()
\Drupal\ccc_hook_order_test\Hook\CHooks::testBothParametersHook()
File
-
core/
tests/ Drupal/ KernelTests/ Core/ Hook/ HookOrderTest.php, line 263
Class
- HookOrderTest
- Tests Hook Order.
Namespace
Drupal\KernelTests\Core\HookCode
public function testBothParametersHookOrder() : void {
$this->assertSameCallList([
BHooks::class . '::testBothParametersHook',
CHooks::class . '::testBothParametersHook',
AHooks::class . '::testBothParametersHook',
], \Drupal::moduleHandler()->invokeAll('test_both_parameters_hook'));
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.