Skip to content

Commit 6282592

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 6282592

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

verify_phpunit_xml/create_phpunit_xml.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,9 @@
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+
require_once("{$dirroot}/lib/phpunit/classes/util.php");
97+
}
9698

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

0 commit comments

Comments
 (0)