Merge branch 'MDL-48859_27' of git://github.com/timhunt/moodle into MOODLE_27_STABLE
This commit is contained in:
@@ -212,8 +212,7 @@ Feature: Award badges
|
||||
And I upload "badges/tests/behat/badge.png" file to "Image" filemanager
|
||||
And I press "Create badge"
|
||||
And I set the field "type" to "Course completion"
|
||||
And I set the following fields to these values:
|
||||
| grade_2 | 0 |
|
||||
And I set the field with xpath "//fieldset/input[1]" to "0"
|
||||
And I press "Save"
|
||||
And I press "Enable access"
|
||||
When I press "Continue"
|
||||
|
||||
@@ -155,6 +155,25 @@ class behat_forms extends behat_base {
|
||||
$this->set_field_value($field, $value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the specified value to the field with xpath.
|
||||
*
|
||||
* @Given /^I set the field with xpath "(?P<fieldxpath_string>(?:[^"]|\\")*)" to "(?P<field_value_string>(?:[^"]|\\")*)"$/
|
||||
* @throws ElementNotFoundException Thrown by behat_base::find
|
||||
* @param string $field
|
||||
* @param string $value
|
||||
* @return void
|
||||
*/
|
||||
public function i_set_the_field_with_xpath_to($fieldxpath, $value) {
|
||||
try {
|
||||
$fieldNode = $this->find('xpath', $fieldxpath);
|
||||
} catch (\Behat\Mink\Exception\ElementNotFoundException $e) {
|
||||
throw new ElementNotFoundException('Field with xpath ' . $fieldxpath . 'not found, so can\'t be set');
|
||||
}
|
||||
$field = behat_field_manager::get_form_field($fieldNode, $this->getSession());
|
||||
$field->set_value($value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks, the field matches the value. More info in http://docs.moodle.org/dev/Acceptance_testing#Providing_values_to_steps.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user