mirror of
https://github.com/moodle/moodle.git
synced 2025-03-14 04:30:15 +01:00
MDL-74020 course: update how required libraries are loaded in test.
Test data providers are executed before `setUpBeforeClass`, so any library constants used by the providers must already be present. Reverts part of the change in 691c5b83.
This commit is contained in:
parent
9cd77c4130
commit
5f810c4724
@ -49,6 +49,12 @@ use restore_controller;
|
||||
use stdClass;
|
||||
use testing_data_generator;
|
||||
|
||||
defined('MOODLE_INTERNAL') or die();
|
||||
|
||||
// Require library globally because it's constants are used within dataProvider methods, executed before setUpBeforeClass.
|
||||
global $CFG;
|
||||
require_once($CFG->dirroot . '/course/lib.php');
|
||||
|
||||
/**
|
||||
* Course related unit tests
|
||||
*
|
||||
@ -65,7 +71,6 @@ class courselib_test extends advanced_testcase {
|
||||
public static function setUpBeforeClass(): void {
|
||||
global $CFG;
|
||||
|
||||
require_once($CFG->dirroot . '/course/lib.php');
|
||||
require_once($CFG->dirroot . '/course/tests/fixtures/course_capability_assignment.php');
|
||||
require_once($CFG->dirroot . '/enrol/imsenterprise/tests/imsenterprise_test.php');
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user