'filter' => false,
'tags' => false,
'extra' => false,
+ 'with-javascript' => false,
'testenvironment' => false
),
array(
Options:
--stepsdefinitions Displays the available steps definitions (accepts --filter=\"\" option to restrict the list to the matching definitions)
---runtests Runs the tests (accepts --tags=\"\" option to execute only the matching tests and --extra=\"\" to specify extra behat options)
+--runtests Runs the tests (accepts --with-javascript option, --tags=\"\" option to execute only the matching tests and --extra=\"\" to specify extra behat options)
--testenvironment Allows the test environment to be accesses through the built-in server (accepts value 'enable' or 'disable')
-h, --help Print out this help
Example from Moodle root directory:
\$ php admin/tool/behat/cli/util.php --runtests --tags=\"tool_behat\"
+
+More info in http://docs.moodle.org/dev/Acceptance_testing#Usage
";
if (!empty($options['help'])) {
break;
case 'runtests':
- tool_behat::runtests($options['tags'], $options['extra']);
+ tool_behat::runtests($options['with-javascript'], $options['tags'], $options['extra']);
break;
case 'testenvironment':
* @param string $tags Restricts the executed tests to the ones that matches the tags
* @param string $extra Extra CLI behat options
*/
- public static function runtests($tags = false, $extra = false) {
+ public static function runtests($withjavascript = false, $tags = false, $extra = false) {
global $CFG;
// Checks that the behat reference is properly set up
@set_time_limit(0);
- // Priority to the one specified as argument.
- if (!$tags) {
- $tags = optional_param('tags', false, PARAM_ALPHANUMEXT);
+ // No javascript by default
+ if (!$withjavascript && strstr($tags, 'javascript') == false) {
+ $jsstr = '~javascript';
}
+ // Adding javascript option to --tags.
$tagsoption = '';
if ($tags) {
+ if (!empty($jsstr)) {
+ $tags .= ',' . $jsstr;
+ }
$tagsoption = ' --tags ' . $tags;
+
+ // No javascript by default.
+ } else if (!empty($jsstr)) {
+ $tagsoption = ' --tags ' . $jsstr;
}
if (!$extra) {