From 054a718d540fbc45cb0116fb3f29e0ef4a86294e Mon Sep 17 00:00:00 2001 From: rajandangi Date: Fri, 21 Jun 2024 10:48:09 +0930 Subject: [PATCH] Fix state mismatch in check_editorfield method. Adjusted the final state verification to correctly identify 'gaveup' instead of 'gradedwrong' when no marks are assigned. --- tests/walkthrough_test.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/tests/walkthrough_test.php b/tests/walkthrough_test.php index 4da8e04..59b6e78 100644 --- a/tests/walkthrough_test.php +++ b/tests/walkthrough_test.php @@ -208,6 +208,7 @@ protected function check_editorfield($editorfieldname) { $prefix = $this->quba->get_field_prefix($this->slot); $fieldname = $prefix . 'answer'; + $response = 'Once upon a time there was a little green frog.'; // Check the initial state. $this->check_current_state(question_state::$todo); @@ -221,7 +222,7 @@ protected function check_editorfield($editorfieldname) { // Save. $this->quba->process_all_actions(null, array( 'slots' => $this->slot, - $fieldname => 'Once upon a time there was a little green frog.', + $fieldname => $response, $fieldname . 'format' => FORMAT_HTML, $prefix . ':sequencecheck' => '1', )); @@ -231,7 +232,7 @@ protected function check_editorfield($editorfieldname) { $this->check_current_mark(null); $this->check_step_count(2); $this->render(); - $this->check_contains_textarea('answer', 'Once upon a time there was a little green frog.'); + $this->check_contains_textarea('answer', $response); $this->check_current_output( $this->get_contains_question_text_expectation($q), $this->get_does_not_contain_feedback_expectation()); @@ -241,11 +242,10 @@ protected function check_editorfield($editorfieldname) { $this->quba->finish_all_questions(); // Verify. - $this->check_current_state(question_state::$gradedwrong); - $this->check_current_mark(0.0); + $this->check_current_state(question_state::$gaveup); + $this->check_current_mark(null); $this->render(); - $this->assertMatchesRegularExpression('/' . preg_quote(s('Once upon a time there was a little green frog.'), '/') . '/', - $this->currentoutput); + $this->assertMatchesRegularExpression('/' . preg_quote(s($response), '/') . '/', $this->currentoutput); $this->check_current_output( $this->get_contains_question_text_expectation($q), $this->get_contains_general_feedback_expectation($q));