Resolve #3519561 Introduce implementationList class for hooks
1 unresolved thread
Closes #3519561
Merge request reports
Activity
398 397 ->willReturn([ 399 398 [$c, 'some_method'], 400 399 ]); 401 $this->assertNotEmpty($module_handler->hasImplementations('some_hook')); 402 403 $listeners = $r->getProperty('invokeMap')->getValue($module_handler)['some_hook']['some_module']; 404 // Anonymous class doesn't work with assertSame() so assert it piecemeal. 405 $this->assertSame(count($listeners), 1); 406 foreach ($listeners as $listener) { 407 $this->assertSame(get_class($c), get_class($listener[0])); 408 $this->assertSame('some_method', $listener[1]); 409 } 400 $this->assertTrue($module_handler->hasImplementations('some_hook')); The assertions I removed assert internal implementation details, which I don't know why we want to test them.
The test method name implies that it is about ->hasImplementations(), not about which specific implementations get stored internally.
If we really want to test something useful, we could test->hasImplementations()
with a hook that has no implementations.But tbh, we should probably do this in a kernel test, where we don't have to mock the event dispatcher.
added 7 commits
- 293edeac - Add docs on ModuleHandlerTest::getModuleHandler().
- 9f932fce - Reorder imports in ModuleHandlerTest.php.
- cf2b7caf - Introduce ImplementationList.
- 1fb77b2a - Drop usage of ->getHookListeners() in ModuleHandler methods.
- f0c583ab - Remove ModuleHandler::getHookListeners() and ImplementationList::groupByModule().
- d3fd1acd - Include files before getting the listeners, in getHookImplementationList().
- 9bc0342e - Assert that listeners in ImplementationList are callable, and update test.
Toggle commit listadded 141 commits
-
9bc0342e...a2db325e - 134 commits from branch
project:11.x
- 0822209f - Add docs on ModuleHandlerTest::getModuleHandler().
- 18a69c65 - Reorder imports in ModuleHandlerTest.php.
- 95bc1dc5 - Introduce ImplementationList.
- cacdee73 - Drop usage of ->getHookListeners() in ModuleHandler methods.
- 445156e3 - Remove ModuleHandler::getHookListeners() and ImplementationList::groupByModule().
- de38fedf - Include files before getting the listeners, in getHookImplementationList().
- fc32af41 - Assert that listeners in ImplementationList are callable, and update test.
Toggle commit list-
9bc0342e...a2db325e - 134 commits from branch
Please register or sign in to reply