MDL-37046 behat: Quick fix
authorDavid Monllao <davidm@moodle.com>
Tue, 29 Jan 2013 06:45:54 +0000 (14:45 +0800)
committerDavid Monllao <davidm@moodle.com>
Tue, 29 Jan 2013 06:46:41 +0000 (14:46 +0800)
Provides feedback when trying to use the web interface
to list steps definitions when $CFG->behat_dataroot hasn't
been set or can not be written

admin/tool/behat/lang/en/tool_behat.php
lib/behat/classes/behat_command.php

index e5693d7..8bb1f1d 100644 (file)
@@ -30,6 +30,7 @@ $string['newstepsinfo'] = 'Read {$a} for info about how to add new steps definit
 $string['newtestsinfo'] = 'Read {$a} for info about how to write new tests';
 $string['nostepsdefinitions'] = 'There aren\'t steps definitions matching this filters';
 $string['pluginname'] = 'Acceptance testing';
+$string['runclitool'] = 'To list the steps definitions you need to run the Behat CLI tool to create the $CFG->behat_dataroot directory. Go to your moodle dirroot and run "{$a}"';
 $string['stepsdefinitionscomponent'] = 'Area';
 $string['stepsdefinitionscontains'] = 'Contains';
 $string['stepsdefinitionsfilters'] = 'Steps definitions';
index 39e8c25..8bdb123 100644 (file)
@@ -132,6 +132,11 @@ class behat_command {
         if ($code != 0) {
             notice(get_string('wrongbehatsetup', 'tool_behat'));
         }
+
+        // Checking behat dataroot existence otherwise notice about admin/tool/behat/cli/util.php.
+        if (empty($CFG->behat_dataroot) || !is_dir($CFG->behat_dataroot) || !is_writable($CFG->behat_dataroot)) {
+            notice(get_string('runclitool', 'tool_behat', 'php admin/tool/behat/cli/util.php'));
+        }
     }
 
     /**