MDL-80072 core: Add \core\di wrapper to php-di

The \core\di class is a Moodle wrapper to php-di which is intended to
allow Moodle to switch to an alternate DI solution in the future if
required. All interaction with the container uses the PSR-11 Container
interfaces, which allows for normalisation of configuration, setting,
and retrieving of DI container-identified classes.
This commit is contained in:
Andrew Nicols
2024-02-12 11:11:16 +08:00
parent 192a7797ab
commit 9ed3f83dd2
5 changed files with 385 additions and 0 deletions
+3
View File
@@ -300,6 +300,9 @@ class phpunit_util extends testing_util {
// Reset user agent.
core_useragent::instance(true, null);
// Reset the DI container.
\core\di::reset_container();
// verify db writes just in case something goes wrong in reset
if (self::$lastdbwrites != $DB->perf_get_writes()) {
error_log('Unexpected DB writes in phpunit_util::reset_all_data()');