From a0735fa71065c37bcd9f72d5acfa2231bc9352d7 Mon Sep 17 00:00:00 2001 From: Andrew Nicols Date: Wed, 13 Sep 2023 11:30:00 +0800 Subject: [PATCH] MDL-79340 core_grading: Use Behat steps to set values --- .../tests/behat/behat_gradingform_rubric.php | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/grade/grading/form/rubric/tests/behat/behat_gradingform_rubric.php b/grade/grading/form/rubric/tests/behat/behat_gradingform_rubric.php index 09c76679dd1..dca76c04603 100644 --- a/grade/grading/form/rubric/tests/behat/behat_gradingform_rubric.php +++ b/grade/grading/form/rubric/tests/behat/behat_gradingform_rubric.php @@ -262,9 +262,13 @@ class behat_gradingform_rubric extends behat_base { 'xpath', ]); - $inputfield = $this->find('xpath', $inputxpath . '|' . $textareaxpath); - $inputfield->setValue($value); - + $this->execute( + 'behat_forms::i_set_the_field_with_xpath_to', + [ + $inputxpath . '|' . $textareaxpath, + $value, + ] + ); } else { $fieldnode = $this->find('xpath', $inputxpath . '|' . $textareaxpath); $this->set_rubric_field_value($fieldnode->getAttribute('name'), $value); @@ -447,8 +451,13 @@ class behat_gradingform_rubric extends behat_base { } // Set the value now. - $description = $this->find_field($name); - $description->setValue($value); + $this->execute( + 'behat_forms::i_set_the_field_to', + [ + $name, + $value, + ] + ); } /**