From 33063f2eb5130638196ed5e6c088eebafc92276a Mon Sep 17 00:00:00 2001 From: David Monllao Date: Tue, 29 Jan 2013 14:45:54 +0800 Subject: [PATCH 1/1] MDL-37046 behat: Quick fix 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 | 1 + lib/behat/classes/behat_command.php | 5 +++++ 2 files changed, 6 insertions(+) diff --git a/admin/tool/behat/lang/en/tool_behat.php b/admin/tool/behat/lang/en/tool_behat.php index e5693d7f5e9..8bb1f1d9174 100644 --- a/admin/tool/behat/lang/en/tool_behat.php +++ b/admin/tool/behat/lang/en/tool_behat.php @@ -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'; diff --git a/lib/behat/classes/behat_command.php b/lib/behat/classes/behat_command.php index 39e8c259957..8bdb123c34c 100644 --- a/lib/behat/classes/behat_command.php +++ b/lib/behat/classes/behat_command.php @@ -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')); + } } /** -- 2.43.0