public function test_deferredfeedback_feedback_turmultiplechoice_single() { // Create a turmultiplechoice, single question. $mc = test_turmultiplechoice_question_maker::make_a_turmultiplechoice_single_question(); $mc->shuffleanswers = false; $mc->answers[14]->fraction = 0.1; // Make one of the choices partially right. $rightindex = 0; $this->start_attempt_at_question($mc, 'deferredfeedback', 3); $this->process_submission(array('answer' => $rightindex)); // Verify. $this->check_current_state(question_state::$complete); $this->check_current_mark(null); $this->check_current_output($this->get_contains_mc_radio_expectation($rightindex, true, true), $this->get_contains_mc_radio_expectation($rightindex + 1, true, false), $this->get_contains_mc_radio_expectation($rightindex + 2, true, false), $this->get_does_not_contain_correctness_expectation(), $this->get_does_not_contain_feedback_expectation()); // Finish the attempt. $this->quba->finish_all_questions(); // Verify. $this->check_current_state(question_state::$gradedright); $this->check_current_mark(3); $this->check_current_output($this->get_contains_mc_radio_expectation($rightindex, false, true), $this->get_contains_correct_expectation(), new PatternExpectation('/class="r0 correct"/'), new PatternExpectation('/class="r1"/')); }
public function test_get_question_summary() { $mc = test_turmultiplechoice_question_maker::make_a_turmultiplechoice_single_question(); $mc->start_attempt(new question_attempt_step(), 1); $qsummary = $mc->get_question_summary(); $this->assertPattern('/' . preg_quote($mc->questiontext) . '/', $qsummary); foreach ($mc->answers as $answer) { $this->assertPattern('/' . preg_quote($answer->answer) . '/', $qsummary); } }