Skip to content

Commit fca70e8

Browse files
committed
Only load \phpunit_util if not autoloadable
From Moodle 5.2 the `\phpunit_util` class has been renamed to `\core\test\phpunit\phpunit_util`, supports the autoloader, and can still be autoloaded from its old location. Attempting to manually load the file leads to a failure.
1 parent b4c849b commit fca70e8

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

verify_phpunit_xml/create_phpunit_xml.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,12 @@
9292
// Now, let's invoke phpunit utils to generate the phpunit.xml file
9393

9494
// We need to load a few things manually.
95-
require_once("{$dirroot}/lib/phpunit/classes/util.php");
95+
if (!class_exists(\phpunit_util::class)) {
96+
// From Moodle 5.2 we can autoload the phpunit_util class.
97+
// Including the old location will throw debugging notices. In this case, because we do not load the full Moodle
98+
// stack, this excepts.
99+
require_once("{$dirroot}/lib/phpunit/classes/util.php");
100+
}
96101

97102
if (!class_exists(\core\output\core_renderer::class)) {
98103
// From Moodle 4.5 we start to autoload the output components and including outputcomponents.php will throw an exception.

0 commit comments

Comments
 (0)