Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

MDL-38280 manual graded behaviour: unit test for when not answered.

If the student does not submit an answer, the questoin goes to state
gaveup, rather than requiresgrading.
  • Loading branch information...
commit 8407a5498b657f272abef2a20317e634de5be10a 1 parent cce0d9a
@timhunt timhunt authored
Showing with 42 additions and 0 deletions.
  1. +42 −0 question/behaviour/manualgraded/tests/walkthrough_test.php
View
42 question/behaviour/manualgraded/tests/walkthrough_test.php
@@ -106,6 +106,48 @@ public function test_manual_graded_essay() {
$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.
Please sign in to comment.
Something went wrong with that request. Please try again.