Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

MDL-39702 generators: Adding MOODLE_INTERNAL

As discussed generators should include MOODLE_INTERNAL
as they make use of CFG and they don't make sense without
requiring config.php.
commit a13cbfb3e73e488dde785851b004a4b5846c5d44 1 parent 799dbbf
@dmonllao dmonllao authored damyon committed
View
1  lib/testing/generator/block_generator.php
@@ -23,6 +23,7 @@
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
+defined('MOODLE_INTERNAL') || die();
/**
* Block generator base class.
View
1  lib/testing/generator/component_generator_base.php
@@ -23,6 +23,7 @@
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
+defined('MOODLE_INTERNAL') || die();
/**
* Component generator base class.
View
1  lib/testing/generator/data_generator.php
@@ -23,6 +23,7 @@
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
+defined('MOODLE_INTERNAL') || die();
/**
* Data generator class for unit tests and other tools that need to create fake test sites.
View
1  lib/testing/generator/module_generator.php
@@ -23,6 +23,7 @@
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
+defined('MOODLE_INTERNAL') || die();
/**
* Module generator base class.
View
2  lib/testing/generator/repository_generator.php
@@ -23,6 +23,8 @@
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
+defined('MOODLE_INTERNAL') || die();
+
/**
* Repository data generator class
*
View
4 lib/tests/behat/behat_data_generators.php
@@ -26,7 +26,6 @@
// NOTE: no MOODLE_INTERNAL test here, this file may be required by behat before including /config.php.
require_once(__DIR__ . '/../../behat/behat_base.php');
-require_once(__DIR__ . '/../../testing/generator/lib.php');
use Behat\Gherkin\Node\TableNode as TableNode;
use Behat\Behat\Exception\PendingException as PendingException;
@@ -127,6 +126,9 @@ class behat_data_generators extends behat_base {
*/
public function the_following_exists($elementname, TableNode $data) {
+ // Now that we need them require the data generators.
+ require_once(__DIR__ . '/../../testing/generator/lib.php');
+
if (empty(self::$elements[$elementname])) {
throw new PendingException($elementname . ' data generator is not implemented');
}
Please sign in to comment.
Something went wrong with that request. Please try again.