From e259795c4fae3be070fe7652277d8dfe8d51988c Mon Sep 17 00:00:00 2001 From: Rajesh Taneja Date: Tue, 26 Jul 2016 11:16:44 +0800 Subject: [PATCH] MDL-55329 behat: PyStrings should end with : (colon) --- lib/tests/behat/behat_deprecated.php | 19 ++++++++++++++++++- lib/tests/behat/behat_forms.php | 2 +- lib/upgrade.txt | 1 + mod/data/tests/behat/required_entries.feature | 4 ++-- 4 files changed, 22 insertions(+), 4 deletions(-) diff --git a/lib/tests/behat/behat_deprecated.php b/lib/tests/behat/behat_deprecated.php index 26774b398b5..5d1ccd8b097 100644 --- a/lib/tests/behat/behat_deprecated.php +++ b/lib/tests/behat/behat_deprecated.php @@ -28,7 +28,8 @@ require_once(__DIR__ . '/../../../lib/behat/behat_base.php'); use Behat\Mink\Exception\ElementNotFoundException as ElementNotFoundException, - Behat\Gherkin\Node\TableNode as TableNode; + Behat\Gherkin\Node\TableNode as TableNode, + Behat\Gherkin\Node\PyStringNode as PyStringNode, /** * Deprecated behat step definitions. @@ -269,6 +270,22 @@ class behat_deprecated extends behat_base { $this->deprecated_message($alternative, true); } + /** + * Sets the specified value to the field. + * + * @Given /^I set the field "(?P(?:[^"]|\\")*)" to multiline$/ + * @throws ElementNotFoundException Thrown by behat_base::find + * @param string $field + * @param PyStringNode $value + * @deprecated since Moodle 3.2 MDL-55406 - please do not use this step any more. + */ + public function i_set_the_field_to_multiline($field, PyStringNode $value) { + + $alternative = 'I set the field "' . $this->escape($field) . '" to multiline:'; + $this->deprecated_message($alternative); + + $this->execute('behat_forms::i_set_the_field_to_multiline', array($field, $value)); + } /** * Throws an exception if $CFG->behat_usedeprecated is not allowed. diff --git a/lib/tests/behat/behat_forms.php b/lib/tests/behat/behat_forms.php index d681d2ccfbf..2b362dfff84 100644 --- a/lib/tests/behat/behat_forms.php +++ b/lib/tests/behat/behat_forms.php @@ -221,7 +221,7 @@ class behat_forms extends behat_base { /** * Sets the specified value to the field. * - * @Given /^I set the field "(?P(?:[^"]|\\")*)" to multiline$/ + * @Given /^I set the field "(?P(?:[^"]|\\")*)" to multiline:$/ * @throws ElementNotFoundException Thrown by behat_base::find * @param string $field * @param PyStringNode $value diff --git a/lib/upgrade.txt b/lib/upgrade.txt index 926ad3d0d59..4f722737c7f 100644 --- a/lib/upgrade.txt +++ b/lib/upgrade.txt @@ -51,6 +51,7 @@ information provided here is intended especially for developers. * Added down arrow: $OUTPUT->darrow. * All file_packer implementations now accept an additional parameter to allow a simple boolean return value instead of an array of individual file statuses. +* "I set the field "field_string" to multiline:" now end with colon (:), as PyStrings is supposed to end with ":" === 3.1 === diff --git a/mod/data/tests/behat/required_entries.feature b/mod/data/tests/behat/required_entries.feature index 0909f42b653..39d34232fec 100644 --- a/mod/data/tests/behat/required_entries.feature +++ b/mod/data/tests/behat/required_entries.feature @@ -36,7 +36,7 @@ Feature: Users can be required to specify certain fields when adding entries to | Field name | Required Two-Option Checkbox | | Field description | Required Two-Option Checkbox | | Required | yes | - And I set the field "Options" to multiline + And I set the field "Options" to multiline: """ RTOC Option 1 RTOC Option 2 @@ -83,7 +83,7 @@ Feature: Users can be required to specify certain fields when adding entries to | Field name | Required Two-Option Multimenu | | Field description | Required Two-Option Multimenu | | Required | yes | - And I set the field "Options" to multiline + And I set the field "Options" to multiline: """ Option 1 Option 2