Improve HookCollectorPass test

Created on 21 January 2025, 3 months ago

Problem/Motivation

1) Drupal\KernelTests\Core\Hook\HookCollectorPassTest::testGetHookAttributesInClass() only executes until line 103. And only 1 assertion for this test, should be 3.
2) There is no test that checks using Hook argument "method".
3) There is not test that checks Class::__invoke().

 * - On a class with an __invoke method, which is taken to be the hook
 *   implementation:
 *   @code
 *   #[Hook('user_cancel')]
 *   class Hooks {
 *     method __invoke(...) {}
 *   }
 *   @endcode

4) Update core.api.php for Hook. Change examples from "method" to "function" For example above:

 *   @code
 *   #[Hook('user_cancel')]
 *   class Hooks {
 *     function __invoke(...) {}
 *   }
 *   @endcode

Steps to reproduce

Proposed resolution

1) Move checking Logic exception to the end of HookCollectorPassTest::testGetHookAttributesInClass() method.
2) Is it possible

Remaining tasks

User interface changes

Introduced terminology

API changes

Data model changes

Release notes snippet

πŸ› Bug report
Status

Active

Version

11.0 πŸ”₯

Component

base system

Created by

πŸ‡·πŸ‡ΊRussia zniki.ru

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

Production build 0.71.5 2024