diff --git a/question/behaviour/manualgraded/tests/walkthrough_test.php b/question/behaviour/manualgraded/tests/walkthrough_test.php index 2b8a4621ae6..41e20766f3c 100644 --- a/question/behaviour/manualgraded/tests/walkthrough_test.php +++ b/question/behaviour/manualgraded/tests/walkthrough_test.php @@ -106,6 +106,48 @@ class qbehaviour_manualgraded_walkthrough_test extends qbehaviour_walkthrough_te $this->check_current_mark(1); } + public function test_manual_graded_essay_not_answered() { + + // Create an essay question. + $essay = test_question_maker::make_an_essay_question(); + $this->start_attempt_at_question($essay, 'deferredfeedback', 10); + + // Check the right model is being used. + $this->assertEquals('manualgraded', $this->quba->get_question_attempt( + $this->slot)->get_behaviour_name()); + + // Check the initial state. + $this->check_current_state(question_state::$todo); + $this->check_current_mark(null); + $this->check_current_output($this->get_contains_question_text_expectation($essay), + $this->get_does_not_contain_feedback_expectation()); + + // Finish the attempt. + $this->quba->finish_all_questions(); + + // Verify. + $this->check_current_state(question_state::$gaveup); + $this->check_current_mark(null); + $this->assertEquals('', + $this->quba->get_response_summary($this->slot)); + + // Process a manual comment. + $this->manual_grade('Not good enough!', 1); + + // Verify. + $this->check_current_state(question_state::$mangrpartial); + $this->check_current_mark(1); + $this->check_current_output( + new question_pattern_expectation('/' . preg_quote('Not good enough!') . '/')); + + // Now change the max mark for the question and regrade. + $this->quba->regrade_question($this->slot, true, 1); + + // Verify. + $this->check_current_state(question_state::$mangrpartial); + $this->check_current_mark(0.1); + } + public function test_manual_graded_truefalse() { // Create a true-false question with correct answer true.