Skip to content

Commit

Permalink
MDL-72125 testing: Make global $CFG available when including generators
Browse files Browse the repository at this point in the history
This will remove the requirement to add the global $CFG call to the top
of generator scripts.
  • Loading branch information
andrewnicols committed Jul 19, 2021
1 parent 2fe23b9 commit aa1f55f
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions lib/testing/generator/data_generator.php
Expand Up @@ -103,6 +103,9 @@ public function reset() {
* @return component_generator_base or rather an instance of the appropriate subclass.
*/
public function get_plugin_generator($component) {
// Note: This global is included so that generator have access to it.
// CFG is widely used in require statements.
global $CFG;
list($type, $plugin) = core_component::normalize_component($component);
$cleancomponent = $type . '_' . $plugin;
if ($cleancomponent != $component) {
Expand Down

0 comments on commit aa1f55f

Please sign in to comment.