From 9776f3dcdb3b21b622ea8a650fe2ef6b545f7fd1 Mon Sep 17 00:00:00 2001 From: John Okely Date: Mon, 23 Feb 2015 14:47:05 +0800 Subject: [PATCH] MDL-5583 behat: Add multiline version of 'And I set the field to' --- lib/tests/behat/behat_forms.php | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/lib/tests/behat/behat_forms.php b/lib/tests/behat/behat_forms.php index f7a5a529e65..fcde5986263 100644 --- a/lib/tests/behat/behat_forms.php +++ b/lib/tests/behat/behat_forms.php @@ -32,6 +32,7 @@ use Behat\Behat\Context\Step\Given as Given, Behat\Behat\Context\Step\When as When, Behat\Behat\Context\Step\Then as Then, Behat\Gherkin\Node\TableNode as TableNode, + Behat\Gherkin\Node\PyStringNode as PyStringNode, Behat\Mink\Element\NodeElement as NodeElement, Behat\Mink\Exception\ExpectationException as ExpectationException, Behat\Mink\Exception\ElementNotFoundException as ElementNotFoundException; @@ -159,6 +160,19 @@ class behat_forms extends behat_base { $this->set_field_value($field, $value); } + /** + * 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 + * @return void + */ + public function i_set_the_field_to_multiline($field, PyStringNode $value) { + $this->set_field_value($field, (string)$value); + } + /** * Sets the specified value to the field with xpath. *