$this->check_current_output(
$this->get_contains_marked_out_of_summary(),
$this->get_does_not_contain_feedback_expectation(),
- $this->get_does_not_contain_validation_error_expectation()); // TODO, really, it should. See MDL-32049.
+ $this->get_contains_validation_error_expectation());
// Save a partially correct answer.
$this->process_submission(array('sub1_answer' => '1', 'sub2_answer' => '1',
new question_hint_with_parts(11, 'This is the first hint.', FORMAT_HTML, false, true),
new question_hint_with_parts(12, 'This is the second hint.', FORMAT_HTML, true, true),
);
- $choices = array('' => '', '0' => 'Califormia', '1' => 'Arizona');
+ $choices = array('' => '', '0' => 'California', '1' => 'Arizona');
$this->start_attempt_at_question($q, 'interactive', 4);
$this->get_no_hint_visible_expectation());
}
+ public function test_interactive_partial_response_does_not_reveal_answer() {
+
+ // Create a multianswer question.
+ $q = test_question_maker::make_question('multianswer', 'fourmc');
+ $q->hints = array(
+ new question_hint_with_parts(11, 'This is the first hint.', FORMAT_HTML, false, true),
+ new question_hint_with_parts(12, 'This is the second hint.', FORMAT_HTML, true, true),
+ );
+ $choices = array('' => '', '0' => 'California', '1' => 'Arizona');
+
+ $this->start_attempt_at_question($q, 'interactive', 4);
+
+ // Check the initial state.
+ $this->check_current_state(question_state::$todo);
+ $this->check_current_mark(null);
+ $this->assertEquals('interactivecountback',
+ $this->quba->get_question_attempt($this->slot)->get_behaviour_name());
+ $this->check_current_output(
+ $this->get_contains_marked_out_of_summary(),
+ $this->get_contains_select_expectation('sub1_answer', $choices, null, true),
+ $this->get_contains_select_expectation('sub2_answer', $choices, null, true),
+ $this->get_contains_select_expectation('sub3_answer', $choices, null, true),
+ $this->get_contains_select_expectation('sub4_answer', $choices, null, true),
+ $this->get_contains_submit_button_expectation(true),
+ $this->get_does_not_contain_validation_error_expectation(),
+ $this->get_does_not_contain_feedback_expectation(),
+ $this->get_tries_remaining_expectation(3),
+ $this->get_does_not_contain_num_parts_correct(),
+ $this->get_no_hint_visible_expectation());
+
+ // Submit an incomplete response response.
+ $this->process_submission(array('sub1_answer' => '1', 'sub2_answer' => '1', '-submit' => 1));
+
+ // Verify.
+ $this->check_current_state(question_state::$invalid);
+ $this->check_current_mark(null);
+ $this->check_current_output(
+ $this->get_contains_select_expectation('sub1_answer', $choices, 1, true),
+ $this->get_contains_select_expectation('sub2_answer', $choices, 1, true),
+ $this->get_contains_select_expectation('sub3_answer', $choices, null, true),
+ $this->get_contains_select_expectation('sub4_answer', $choices, null, true),
+ $this->get_does_not_contain_num_parts_correct(),
+ $this->get_contains_validation_error_expectation(),
+ $this->get_contains_submit_button_expectation(true),
+ $this->get_does_not_contain_try_again_button_expectation(),
+ $this->get_does_not_contain_correctness_expectation(),
+ $this->get_no_hint_visible_expectation());
+ $this->render();
+ $a = array('mark' => '0.00', 'max' => '1.00');
+ $this->assertNotRegExp('~' . preg_quote(get_string('markoutofmax', 'question', $a), '~') . '~',
+ $this->currentoutput);
+ $a['mark'] = '1.00';
+ $this->assertNotRegExp('~' . preg_quote(get_string('markoutofmax', 'question', $a), '~') . '~',
+ $this->currentoutput);
+ }
+
public function test_interactivecountback_feedback() {
// Create a multianswer question.
new question_hint_with_parts(11, 'This is the first hint.', FORMAT_HTML, true, true),
new question_hint_with_parts(12, 'This is the second hint.', FORMAT_HTML, true, true),
);
- $choices = array('' => '', '0' => 'Califormia', '1' => 'Arizona');
+ $choices = array('' => '', '0' => 'California', '1' => 'Arizona');
$this->start_attempt_at_question($q, 'interactive', 12);