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.
This commit is contained in:
Tim Hunt
2013-03-01 17:04:04 +00:00
parent cce0d9a100
commit 8407a5498b
@@ -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.