MDL-81456 core: Use DI for all hook access

Using DI for all hook access means that it becomes significantly easier
to mock hooks and callbacks for unit testing without fundamentally
altering the structure of the code purely for the purposes of unit
testing.
This commit is contained in:
Andrew Nicols
2024-04-08 09:35:41 +08:00
parent 26649f5750
commit 2b49ad42f5
17 changed files with 89 additions and 42 deletions
+1 -1
View File
@@ -130,7 +130,7 @@ class user_bulk_action_form extends moodleform {
}
// Any plugin can append user bulk actions to this list by implementing a hook callback.
\core\hook\manager::get_instance()->dispatch($hook);
\core\di::get(\core\hook\manager::class)->dispatch($hook);
// This method may be called from 'Bulk actions' and 'Browse user list' pages. Some actions
// may be irrelevant in one of the contexts and they can be excluded by specifying the