Skip to content

Commit

Permalink
MDL-37046 behat: Quick fix
Browse files Browse the repository at this point in the history
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
  • Loading branch information
David Monllao committed Jan 29, 2013
1 parent ec017a3 commit 33063f2
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
1 change: 1 addition & 0 deletions admin/tool/behat/lang/en/tool_behat.php
Expand Up @@ -30,6 +30,7 @@
$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';
Expand Down
5 changes: 5 additions & 0 deletions lib/behat/classes/behat_command.php
Expand Up @@ -132,6 +132,11 @@ public static function check_behat_setup($checkphp = false) {
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'));
}
}

/**
Expand Down

0 comments on commit 33063f2

Please sign in to comment.