Skip to content

Commit

Permalink
Stop autoloading lib/outputcomponents.php if the classes already exist
Browse files Browse the repository at this point in the history
MDL-82183 moved all of the output classes to support autoloading and
added exceptions to prevent manual inclusion of these files.
  • Loading branch information
andrewnicols committed Jun 27, 2024
1 parent ee6273f commit 76b8513
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions verify_phpunit_xml/create_phpunit_xml.php
Original file line number Diff line number Diff line change
Expand Up @@ -85,9 +85,15 @@

// Now, let's invoke phpunit utils to generate the phpunit.xml file

// We need to load a few stuff.
// We need to load a few things manually.
require_once($options['basedir'] . '/lib/phpunit/classes/util.php');
require_once($options['basedir'] . '/lib/outputcomponents.php');

if (!class_exists(\core\output\core_renderer::class)) {
// From Moodle 4.5 we start to autoload the output components and including outputcomponents.php will throw an exception.
// If the core_renderer class can be autoloaded then we do not need to include outputcomponents.php.
require_once($options['basedir'] . '/lib/outputcomponents.php');
}

require_once($options['basedir'] . '/lib/testing/lib.php');
phpunit_util::build_config_file();

Expand Down

0 comments on commit 76b8513

Please sign in to comment.