diff --git a/admin/tool/behat/tests/tool_behat_test.php b/admin/tool/behat/tests/tool_behat_test.php index 09db5e659c7..366db4acaca 100644 --- a/admin/tool/behat/tests/tool_behat_test.php +++ b/admin/tool/behat/tests/tool_behat_test.php @@ -150,11 +150,6 @@ class tool_behat_testcase extends advanced_testcase { $this->markTestSkipped('Behat not installed.'); } - // It is possible that it has no value. - if (empty($CFG->behat_wwwroot)) { - $CFG->behat_wwwroot = behat_get_wwwroot(); - } - // To avoid user value at config.php level. unset($CFG->behat_config); @@ -178,6 +173,9 @@ class tool_behat_testcase extends advanced_testcase { // directories values. $this->assertContains($CFG->dirroot . DIRECTORY_SEPARATOR . 'lib' . DIRECTORY_SEPARATOR . 'behat' . DIRECTORY_SEPARATOR . 'features', $contents); + // If it was empty should be filled by behat_config_manager::get_config_file_contents(). + $this->assertNotNull($CFG->behat_wwwroot); + // Not quoted strings. $this->assertContains('micarro: /me/lo/robaron', $contents); $this->assertContains('class: behat_init_context', $contents); diff --git a/lib/behat/classes/behat_config_manager.php b/lib/behat/classes/behat_config_manager.php index 11fbf4d1a3b..a1f9977bc9f 100644 --- a/lib/behat/classes/behat_config_manager.php +++ b/lib/behat/classes/behat_config_manager.php @@ -173,6 +173,11 @@ class behat_config_manager { // We require here when we are sure behat dependencies are available. require_once($CFG->dirroot . '/vendor/autoload.php'); + // It is possible that it has no value. + if (empty($CFG->behat_wwwroot)) { + $CFG->behat_wwwroot = behat_get_wwwroot(); + } + $basedir = $CFG->dirroot . DIRECTORY_SEPARATOR . 'lib' . DIRECTORY_SEPARATOR . 'behat'; $config = array( 'default' => array(