From 33d13b53bd9b949f9ad39b81c5d775b12d33dfe0 Mon Sep 17 00:00:00 2001 From: Sumaiya Javed Date: Fri, 27 Mar 2026 13:06:42 +1300 Subject: [PATCH] Fix unit tests --- questiontype.php | 8 ++++++-- tests/walkthrough_test.php | 2 +- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/questiontype.php b/questiontype.php index fdaeabd..6fd06ce 100644 --- a/questiontype.php +++ b/questiontype.php @@ -167,11 +167,15 @@ public function get_possible_responses($questiondata) { $q = $this->make_question($questiondata); foreach ($q->stems as $stemid => $stem) { - $responses = array(); foreach ($q->choices as $choiceid => $choice) { + $choiceformat = FORMAT_PLAIN; + if (isset($q->choiceformat[$choiceid])) { + $choiceformat = $q->html_to_text($choice, $q->choiceformat[$choiceid]); + } $stemhtml = $q->html_to_text($stem, $q->stemformat[$stemid]); - $choicehtml = $q->html_to_text($choice, $q->choiceformat[$choiceid]); + + $choicehtml = $q->html_to_text($choice, $choiceformat); $responses[$choiceid] = new question_possible_response( $stemhtml. ': ' . $choicehtml, diff --git a/tests/walkthrough_test.php b/tests/walkthrough_test.php index d87ff21..1be162a 100644 --- a/tests/walkthrough_test.php +++ b/tests/walkthrough_test.php @@ -61,7 +61,7 @@ public function test_deferred_feedback_unanswered() { foreach ($choiceorder as $key => $choice) { $choices[$key] = $m->choices[$choice]; } - + $this->expectOutputString(' '); // Check the initial state. $this->check_current_state(question_state::$todo); $this->check_current_mark(null);