MDL-41592 behat: Setting a default value for CFG->behat_wwwroot in case it is empty
authorDavid Monllao <davidm@moodle.com>
Wed, 4 Dec 2013 03:58:32 +0000 (11:58 +0800)
committerSam Hemelryk <sam@moodle.com>
Thu, 5 Dec 2013 04:06:02 +0000 (17:06 +1300)
admin/tool/behat/tests/tool_behat_test.php

index c8fa488..09db5e6 100644 (file)
@@ -150,6 +150,11 @@ 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);
 
@@ -183,6 +188,8 @@ class tool_behat_testcase extends advanced_testcase {
         // Lists.
         $this->assertContains('- feature1', $contents);
         $this->assertContains('- feature3', $contents);
+
+        unset($CFG->behat_wwwroot);
     }
 
 }