MDL-37046 behat: Skip unit test if behat is not installed
authorDavid Monllao <davidm@moodle.com>
Tue, 29 Jan 2013 04:50:17 +0000 (12:50 +0800)
committerDavid Monllao <davidm@moodle.com>
Tue, 29 Jan 2013 04:54:48 +0000 (12:54 +0800)
admin/tool/behat/tests/tool_behat_test.php

index 12db2e0..4c9ae8f 100644 (file)
@@ -145,6 +145,12 @@ class tool_behat_testcase extends advanced_testcase {
     public function test_config_file_contents() {
         global $CFG;
 
+        // Skip tests if behat is not installed.
+        $vendorpath = $CFG->dirroot . '/vendor';
+        if (!file_exists($vendorpath . '/autoload.php') || !is_dir($vendorpath . '/behat')) {
+            $this->markTestSkipped('Behat not installed.');
+        }
+
         // To avoid user value at config.php level.
         unset($CFG->behat_config);