MDL-67740 behat: Allow multiple words filter at acceptance testing page

Because of the too strict input param type, the form did not allow to
search for Behat steps containing the given phrase. The patch sets the
param type to match the one in the form definition, and makes sure that
the submitted value can be safely used as a CLI script argument.
This commit is contained in:
David Mudrák 2020-01-20 20:56:48 +01:00
parent 4e41ace0be
commit 25d7262707
3 changed files with 10 additions and 2 deletions

View File

@ -32,7 +32,7 @@ require_once($CFG->libdir . '/behat/classes/behat_config_manager.php');
// systems, but let's allow room for expansion.
core_php_time_limit::raise(300);
$filter = optional_param('filter', '', PARAM_ALPHANUMEXT);
$filter = optional_param('filter', '', PARAM_NOTAGS);
$type = optional_param('type', false, PARAM_ALPHAEXT);
$component = optional_param('component', '', PARAM_ALPHAEXT);

View File

@ -61,7 +61,7 @@ class tool_behat {
}
if ($filter) {
$filteroption = ' -d "' . $filter . '"';
$filteroption = ' -d ' . escapeshellarg($filter);
} else {
$filteroption = ' -di';
}

View File

@ -26,3 +26,11 @@ Feature: List the system steps definitions
Given I set the field "Contains" to "homepage"
When I press "Filter"
Then I should see "Opens Moodle homepage."
@javascript
Scenario: Filtering by the multiple words pattern
Given I set the field "Contains" to "should exist"
When I press "Filter"
Then I should not see "There aren't steps definitions matching this filter"
And I should see "Checks the provided element and selector type exists in the current page."
And I should see "Checks that an element and selector type exists in another element and selector type on the current page."