From 81e47a35e8bb98a94ea88e45eee63dcda1b46f74 Mon Sep 17 00:00:00 2001 From: Tim Hunt Date: Tue, 1 Mar 2016 15:57:48 +0000 Subject: [PATCH] MDL-53304 question behaviour: don't show useless Check buttons Previously, the Check button was often shown disabled when it could not be used (e.g. when the question was finished, or when an interactive question was in the try-again state). Eventually we realised it was better usability to hide it in these cases. Note that when a teacher reviews an in-progress quiz attempt, they will see a disabled Check button if the student doing the quiz can see the button. --- .../adaptive/tests/walkthrough_test.php | 16 ++++++++-------- .../adaptivenopenalty/tests/walkthrough_test.php | 4 ++-- question/behaviour/interactive/renderer.php | 3 +++ .../interactive/tests/walkthrough_test.php | 12 ++++++------ .../tests/walkthrough_test.php | 4 ++-- question/behaviour/rendererbase.php | 3 +++ question/behaviour/upgrade.txt | 10 ++++++++++ question/engine/tests/helpers.php | 16 ++++++++++++++++ .../type/calculated/tests/walkthrough_test.php | 2 +- .../calculatedmulti/tests/walkthrough_test.php | 2 +- .../calculatedsimple/tests/walkthrough_test.php | 2 +- .../ddimageortext/tests/walkthrough_test.php | 14 +++++++------- .../type/ddmarker/tests/walkthrough_test.php | 14 +++++++------- question/type/ddwtos/tests/walkthrough_test.php | 16 ++++++++-------- .../type/gapselect/tests/walkthrough_test.php | 4 ++-- question/type/match/tests/walkthrough_test.php | 10 +++++----- .../type/multianswer/tests/walkthrough_test.php | 8 ++++---- .../type/numerical/tests/walkthrough_test.php | 2 +- .../randomsamatch/tests/walkthrough_test.php | 10 +++++----- 19 files changed, 92 insertions(+), 60 deletions(-) diff --git a/question/behaviour/adaptive/tests/walkthrough_test.php b/question/behaviour/adaptive/tests/walkthrough_test.php index adfcebc44eb..eeb3a2e6fb8 100644 --- a/question/behaviour/adaptive/tests/walkthrough_test.php +++ b/question/behaviour/adaptive/tests/walkthrough_test.php @@ -232,7 +232,7 @@ class qbehaviour_adaptive_walkthrough_test extends qbehaviour_walkthrough_test_b $this->check_current_mark(2); $this->check_current_output( $this->get_contains_mark_summary(2), - $this->get_contains_submit_button_expectation(false), + $this->get_does_not_contain_submit_button_expectation(), $this->get_contains_correct_expectation()); } @@ -310,7 +310,7 @@ class qbehaviour_adaptive_walkthrough_test extends qbehaviour_walkthrough_test_b $this->check_current_mark(0.8); $this->check_current_output( $this->get_contains_mark_summary(0.8), - $this->get_contains_submit_button_expectation(false), + $this->get_does_not_contain_submit_button_expectation(), $this->get_contains_correct_expectation(), $this->get_does_not_contain_validation_error_expectation()); } @@ -393,7 +393,7 @@ class qbehaviour_adaptive_walkthrough_test extends qbehaviour_walkthrough_test_b $this->check_current_mark(4.00); $this->check_current_output( $this->get_contains_mark_summary(4.00), - $this->get_contains_submit_button_expectation(false), + $this->get_does_not_contain_submit_button_expectation(), $this->get_contains_incorrect_expectation(), $this->get_does_not_contain_validation_error_expectation()); } @@ -475,7 +475,7 @@ class qbehaviour_adaptive_walkthrough_test extends qbehaviour_walkthrough_test_b $this->check_current_mark(0.66666667); $this->check_current_output( $this->get_contains_mark_summary(0.67), - $this->get_contains_submit_button_expectation(false), + $this->get_does_not_contain_submit_button_expectation(), $this->get_contains_incorrect_expectation(), $this->get_does_not_contain_validation_error_expectation()); } @@ -532,7 +532,7 @@ class qbehaviour_adaptive_walkthrough_test extends qbehaviour_walkthrough_test_b $this->check_current_mark(1.0); $this->check_current_output( $this->get_contains_mark_summary(1.0), - $this->get_contains_submit_button_expectation(false), + $this->get_does_not_contain_submit_button_expectation(), $this->get_contains_correct_expectation(), $this->get_does_not_contain_validation_error_expectation()); } @@ -646,7 +646,7 @@ class qbehaviour_adaptive_walkthrough_test extends qbehaviour_walkthrough_test_b $this->check_current_mark(1); $this->check_current_output( $this->get_contains_mark_summary(1), - $this->get_contains_submit_button_expectation(false), + $this->get_does_not_contain_submit_button_expectation(), $this->get_contains_incorrect_expectation(), $this->get_does_not_contain_validation_error_expectation()); } @@ -749,7 +749,7 @@ class qbehaviour_adaptive_walkthrough_test extends qbehaviour_walkthrough_test_b $this->check_current_mark(0.9); $this->check_current_output( $this->get_contains_mark_summary(0.9), - $this->get_contains_submit_button_expectation(false), + $this->get_does_not_contain_submit_button_expectation(), $this->get_contains_incorrect_expectation(), $this->get_does_not_contain_validation_error_expectation(), $this->get_does_not_contain_disregarded_info_expectation()); @@ -848,7 +848,7 @@ class qbehaviour_adaptive_walkthrough_test extends qbehaviour_walkthrough_test_b $this->check_output_contains_text_input_with_class('sub1_answer', 'correct'); $this->check_current_output( $this->get_contains_mark_summary(8.00), - $this->get_contains_submit_button_expectation(false), + $this->get_does_not_contain_submit_button_expectation(), $this->get_contains_correct_expectation(), $this->get_does_not_contain_validation_error_expectation()); } diff --git a/question/behaviour/adaptivenopenalty/tests/walkthrough_test.php b/question/behaviour/adaptivenopenalty/tests/walkthrough_test.php index c8de4385536..42aef5134d5 100644 --- a/question/behaviour/adaptivenopenalty/tests/walkthrough_test.php +++ b/question/behaviour/adaptivenopenalty/tests/walkthrough_test.php @@ -213,7 +213,7 @@ class qbehaviour_adaptivenopenalty_walkthrough_test extends qbehaviour_walkthrou $this->check_current_mark(2); $this->check_current_output( $this->get_contains_mark_summary(2), - $this->get_contains_submit_button_expectation(false), + $this->get_does_not_contain_submit_button_expectation(), $this->get_contains_correct_expectation()); } @@ -305,7 +305,7 @@ class qbehaviour_adaptivenopenalty_walkthrough_test extends qbehaviour_walkthrou $this->check_current_mark(1.0); $this->check_current_output( $this->get_contains_mark_summary(1.0), - $this->get_contains_submit_button_expectation(false), + $this->get_does_not_contain_submit_button_expectation(), $this->get_contains_incorrect_expectation(), $this->get_does_not_contain_validation_error_expectation()); } diff --git a/question/behaviour/interactive/renderer.php b/question/behaviour/interactive/renderer.php index 4bae37a6a2e..89c5d9c8928 100644 --- a/question/behaviour/interactive/renderer.php +++ b/question/behaviour/interactive/renderer.php @@ -36,6 +36,9 @@ defined('MOODLE_INTERNAL') || die(); */ class qbehaviour_interactive_renderer extends qbehaviour_renderer { public function controls(question_attempt $qa, question_display_options $options) { + if ($options->readonly === qbehaviour_interactive::READONLY_EXCEPT_TRY_AGAIN) { + return ''; + } return $this->submit_button($qa, $options); } diff --git a/question/behaviour/interactive/tests/walkthrough_test.php b/question/behaviour/interactive/tests/walkthrough_test.php index 1e2d839138c..8485e6a0ac8 100644 --- a/question/behaviour/interactive/tests/walkthrough_test.php +++ b/question/behaviour/interactive/tests/walkthrough_test.php @@ -95,7 +95,7 @@ class qbehaviour_interactive_walkthrough_test extends qbehaviour_walkthrough_tes $this->get_contains_mc_radio_expectation($wrongindex, false, true), $this->get_contains_mc_radio_expectation(($wrongindex + 1) % 3, false, false), $this->get_contains_mc_radio_expectation(($wrongindex + 1) % 3, false, false), - $this->get_contains_submit_button_expectation(false), + $this->get_does_not_contain_submit_button_expectation(), $this->get_contains_try_again_button_expectation(true), $this->get_does_not_contain_correctness_expectation(), new question_pattern_expectation('/Tries remaining: 2/'), @@ -135,7 +135,7 @@ class qbehaviour_interactive_walkthrough_test extends qbehaviour_walkthrough_tes $this->get_contains_mc_radio_expectation($rightindex, false, true), $this->get_contains_mc_radio_expectation(($rightindex + 1) % 3, false, false), $this->get_contains_mc_radio_expectation(($rightindex + 1) % 3, false, false), - $this->get_contains_submit_button_expectation(false), + $this->get_does_not_contain_submit_button_expectation(), $this->get_contains_correct_expectation(), $this->get_no_hint_visible_expectation()); @@ -219,7 +219,7 @@ class qbehaviour_interactive_walkthrough_test extends qbehaviour_walkthrough_tes $this->get_contains_mc_radio_expectation($wrongindex, false, true), $this->get_contains_mc_radio_expectation(($wrongindex + 1) % 3, false, false), $this->get_contains_mc_radio_expectation(($wrongindex + 1) % 3, false, false), - $this->get_contains_submit_button_expectation(false), + $this->get_does_not_contain_submit_button_expectation(), $this->get_contains_try_again_button_expectation(true), $this->get_does_not_contain_correctness_expectation(), new question_pattern_expectation('/Tries remaining: 1/'), @@ -283,7 +283,7 @@ class qbehaviour_interactive_walkthrough_test extends qbehaviour_walkthrough_tes $this->check_current_mark(null); $this->check_current_output( $this->get_contains_marked_out_of_summary(), - $this->get_contains_submit_button_expectation(false), + $this->get_does_not_contain_submit_button_expectation(), $this->get_does_not_contain_validation_error_expectation(), $this->get_contains_try_again_button_expectation(true), new question_pattern_expectation('/Tries remaining: 2/'), @@ -327,7 +327,7 @@ class qbehaviour_interactive_walkthrough_test extends qbehaviour_walkthrough_tes $this->check_current_mark(0.6666667); $this->check_current_output( $this->get_contains_mark_summary(0.6666667), - $this->get_contains_submit_button_expectation(false), + $this->get_does_not_contain_submit_button_expectation(), $this->get_contains_correct_expectation(), $this->get_does_not_contain_validation_error_expectation(), $this->get_no_hint_visible_expectation()); @@ -380,7 +380,7 @@ class qbehaviour_interactive_walkthrough_test extends qbehaviour_walkthrough_tes $this->get_contains_mc_checkbox_expectation($right[1], false, false), $this->get_contains_mc_checkbox_expectation($wrong[0], false, true), $this->get_contains_mc_checkbox_expectation($wrong[1], false, false), - $this->get_contains_submit_button_expectation(false), + $this->get_does_not_contain_submit_button_expectation(), $this->get_contains_try_again_button_expectation(true), $this->get_does_not_contain_correctness_expectation(), new question_pattern_expectation('/Tries remaining: 2/'), diff --git a/question/behaviour/interactivecountback/tests/walkthrough_test.php b/question/behaviour/interactivecountback/tests/walkthrough_test.php index 8c87b3d2bc3..0523aa7705a 100644 --- a/question/behaviour/interactivecountback/tests/walkthrough_test.php +++ b/question/behaviour/interactivecountback/tests/walkthrough_test.php @@ -87,7 +87,7 @@ class qbehaviour_interactivecountback_walkthrough_test extends qbehaviour_walkth $this->get_contains_select_expectation('sub1', $choices, $orderforchoice[1], false), $this->get_contains_select_expectation('sub2', $choices, $orderforchoice[1], false), $this->get_contains_select_expectation('sub3', $choices, $orderforchoice[1], false), - $this->get_contains_submit_button_expectation(false), + $this->get_does_not_contain_submit_button_expectation(), $this->get_contains_try_again_button_expectation(true), $this->get_does_not_contain_correctness_expectation(), new question_pattern_expectation('/Tries remaining: 2/'), @@ -139,7 +139,7 @@ class qbehaviour_interactivecountback_walkthrough_test extends qbehaviour_walkth $this->get_contains_select_expectation('sub1', $choices, $orderforchoice[2], false), $this->get_contains_select_expectation('sub2', $choices, $orderforchoice[2], false), $this->get_contains_select_expectation('sub3', $choices, $orderforchoice[1], false), - $this->get_contains_submit_button_expectation(false), + $this->get_does_not_contain_submit_button_expectation(), $this->get_does_not_contain_try_again_button_expectation(), $this->get_contains_correct_expectation(), $this->get_contains_standard_correct_combined_feedback_expectation(), diff --git a/question/behaviour/rendererbase.php b/question/behaviour/rendererbase.php index 41f58b24b2a..cdcb2d241b6 100644 --- a/question/behaviour/rendererbase.php +++ b/question/behaviour/rendererbase.php @@ -208,6 +208,9 @@ abstract class qbehaviour_renderer extends plugin_renderer_base { * @return string HTML fragment. */ protected function submit_button(question_attempt $qa, question_display_options $options) { + if (!$qa->get_state()->is_active()) { + return ''; + } $attributes = array( 'type' => 'submit', 'id' => $qa->get_behaviour_field_name('submit'), diff --git a/question/behaviour/upgrade.txt b/question/behaviour/upgrade.txt index 5c530cd8ebe..235e9530d40 100644 --- a/question/behaviour/upgrade.txt +++ b/question/behaviour/upgrade.txt @@ -1,5 +1,15 @@ This files describes API changes for question behaviour plugins. +=== 3.1 === + +1) The standard behaviours that use a 'Check' button have all been changed so + that they only show the button when the question is active. Your behaviour + may interit this behaviour, because the change was made in the base class, + and this is probably good for consistency. However, if your question behaviour + uses the Check button, your probably want to test it carefully, and you will + probably have to update your unit tests. See MDL-53304 for more details. + + === 2.9 === 1) There are new methods question_behaviour::can_finish_during_attempt and diff --git a/question/engine/tests/helpers.php b/question/engine/tests/helpers.php index c472e1eb9ea..8a89633b879 100644 --- a/question/engine/tests/helpers.php +++ b/question/engine/tests/helpers.php @@ -1103,11 +1103,27 @@ abstract class qbehaviour_walkthrough_test_base extends question_testcase { return new question_contains_tag_with_attributes('input', $expectedattributes, $forbiddenattributes); } + /** + * Returns an epectation that a string contains the HTML of a button with + * name {question-attempt prefix}-submit, and eiter enabled or not. + * @param bool $enabled if not null, check the enabled/disabled state of the button. True = enabled. + * @return question_contains_tag_with_attributes an expectation for use with check_current_output. + */ protected function get_contains_submit_button_expectation($enabled = null) { return $this->get_contains_button_expectation( $this->quba->get_field_prefix($this->slot) . '-submit', null, $enabled); } + /** + * Returns an epectation that a string does not contain the HTML of a button with + * name {question-attempt prefix}-submit. + * @return question_contains_tag_with_attributes an expectation for use with check_current_output. + */ + protected function get_does_not_contain_submit_button_expectation() { + return new question_no_pattern_expectation('/name="' . + $this->quba->get_field_prefix($this->slot) . '-submit"/'); + } + protected function get_tries_remaining_expectation($n) { return new question_pattern_expectation('/' . preg_quote(get_string('triesremaining', 'qbehaviour_interactive', $n), '/') . '/'); diff --git a/question/type/calculated/tests/walkthrough_test.php b/question/type/calculated/tests/walkthrough_test.php index 11b7ebc01e7..89013c59e8d 100644 --- a/question/type/calculated/tests/walkthrough_test.php +++ b/question/type/calculated/tests/walkthrough_test.php @@ -98,7 +98,7 @@ class qtype_calculated_walkthrough_test extends qbehaviour_walkthrough_test_base $this->check_current_mark(3); $this->check_current_output( $this->get_contains_mark_summary(3), - $this->get_contains_submit_button_expectation(false), + $this->get_does_not_contain_submit_button_expectation(), $this->get_contains_correct_expectation(), $this->get_does_not_contain_validation_error_expectation(), $this->get_no_hint_visible_expectation()); diff --git a/question/type/calculatedmulti/tests/walkthrough_test.php b/question/type/calculatedmulti/tests/walkthrough_test.php index de31a58c45b..00fddcaa575 100644 --- a/question/type/calculatedmulti/tests/walkthrough_test.php +++ b/question/type/calculatedmulti/tests/walkthrough_test.php @@ -98,7 +98,7 @@ class qtype_calculatedmulti_walkthrough_test extends qbehaviour_walkthrough_test $this->check_current_mark(3); $this->check_current_output( $this->get_contains_mark_summary(3), - $this->get_contains_submit_button_expectation(false), + $this->get_does_not_contain_submit_button_expectation(), $this->get_contains_correct_expectation(), $this->get_does_not_contain_validation_error_expectation(), $this->get_no_hint_visible_expectation()); diff --git a/question/type/calculatedsimple/tests/walkthrough_test.php b/question/type/calculatedsimple/tests/walkthrough_test.php index 63e639fb804..46af97e3054 100644 --- a/question/type/calculatedsimple/tests/walkthrough_test.php +++ b/question/type/calculatedsimple/tests/walkthrough_test.php @@ -97,7 +97,7 @@ class qtype_calculatedsimple_walkthrough_test extends qbehaviour_walkthrough_tes $this->check_current_mark(3); $this->check_current_output( $this->get_contains_mark_summary(3), - $this->get_contains_submit_button_expectation(false), + $this->get_does_not_contain_submit_button_expectation(), $this->get_contains_correct_expectation(), $this->get_does_not_contain_validation_error_expectation(), $this->get_no_hint_visible_expectation()); diff --git a/question/type/ddimageortext/tests/walkthrough_test.php b/question/type/ddimageortext/tests/walkthrough_test.php index 71e3eef575a..932ac1bce34 100644 --- a/question/type/ddimageortext/tests/walkthrough_test.php +++ b/question/type/ddimageortext/tests/walkthrough_test.php @@ -180,7 +180,7 @@ class qtype_ddimageortext_walkthrough_test extends qbehaviour_walkthrough_test_b $this->quba->get_field_prefix($this->slot) . 'p3', '1'), $this->get_contains_hidden_expectation( $this->quba->get_field_prefix($this->slot) . 'p4', '2'), - $this->get_contains_submit_button_expectation(false), + $this->get_does_not_contain_submit_button_expectation(), $this->get_contains_correct_expectation(), $this->get_no_hint_visible_expectation()); @@ -469,7 +469,7 @@ class qtype_ddimageortext_walkthrough_test extends qbehaviour_walkthrough_test_b $this->get_contains_drag_image_home_expectation(2, 2, 1), $this->get_contains_drag_image_home_expectation(3, 1, 2), $this->get_contains_drag_image_home_expectation(4, 2, 2), - $this->get_contains_submit_button_expectation(false), + $this->get_does_not_contain_submit_button_expectation(), $this->get_contains_try_again_button_expectation(true), $this->get_does_not_contain_correctness_expectation(), $this->get_contains_hint_expectation('This is the first hint'), @@ -530,7 +530,7 @@ class qtype_ddimageortext_walkthrough_test extends qbehaviour_walkthrough_test_b $this->get_contains_drag_image_home_expectation(2, 2, 1), $this->get_contains_drag_image_home_expectation(3, 1, 2), $this->get_contains_drag_image_home_expectation(4, 2, 2), - $this->get_contains_submit_button_expectation(false), + $this->get_does_not_contain_submit_button_expectation(), $this->get_contains_try_again_button_expectation(true), $this->get_does_not_contain_correctness_expectation(), $this->get_contains_hint_expectation('This is the second hint'), @@ -592,7 +592,7 @@ class qtype_ddimageortext_walkthrough_test extends qbehaviour_walkthrough_test_b $this->quba->get_field_prefix($this->slot) . 'p3', 1), $this->get_contains_hidden_expectation( $this->quba->get_field_prefix($this->slot) . 'p4', 2), - $this->get_contains_submit_button_expectation(false), + $this->get_does_not_contain_submit_button_expectation(), $this->get_does_not_contain_try_again_button_expectation(), $this->get_contains_correct_expectation(), $this->get_no_hint_visible_expectation(), @@ -648,7 +648,7 @@ class qtype_ddimageortext_walkthrough_test extends qbehaviour_walkthrough_test_b $this->get_contains_drag_image_home_expectation(2, 2, 1), $this->get_contains_drag_image_home_expectation(3, 1, 2), $this->get_contains_drag_image_home_expectation(4, 2, 2), - $this->get_contains_submit_button_expectation(false), + $this->get_does_not_contain_submit_button_expectation(), $this->get_contains_correct_expectation(), $this->get_no_hint_visible_expectation()); @@ -710,7 +710,7 @@ class qtype_ddimageortext_walkthrough_test extends qbehaviour_walkthrough_test_b $this->get_contains_drag_image_home_expectation(2, 2, 1), $this->get_contains_drag_image_home_expectation(3, 1, 2), $this->get_contains_drag_image_home_expectation(4, 2, 2), - $this->get_contains_submit_button_expectation(false), + $this->get_does_not_contain_submit_button_expectation(), $this->get_contains_partcorrect_expectation(), $this->get_no_hint_visible_expectation()); @@ -769,7 +769,7 @@ class qtype_ddimageortext_walkthrough_test extends qbehaviour_walkthrough_test_b $this->get_contains_drag_image_home_expectation(2, 2, 1), $this->get_contains_drag_image_home_expectation(3, 1, 2), $this->get_contains_drag_image_home_expectation(4, 2, 2), - $this->get_contains_submit_button_expectation(false), + $this->get_does_not_contain_submit_button_expectation(), $this->get_contains_hint_expectation('This is the first hint')); // Do try again. diff --git a/question/type/ddmarker/tests/walkthrough_test.php b/question/type/ddmarker/tests/walkthrough_test.php index ae2a7348f37..afaf4a6f4f0 100644 --- a/question/type/ddmarker/tests/walkthrough_test.php +++ b/question/type/ddmarker/tests/walkthrough_test.php @@ -168,7 +168,7 @@ class qtype_ddmarker_walkthrough_test extends qbehaviour_walkthrough_test_base { $this->get_contains_hidden_expectation(1, '50,50'), $this->get_contains_hidden_expectation(2, '150,50'), $this->get_contains_hidden_expectation(3, '100,150'), - $this->get_contains_submit_button_expectation(false), + $this->get_does_not_contain_submit_button_expectation(), $this->get_contains_correct_expectation(), $this->get_no_hint_visible_expectation()); @@ -399,7 +399,7 @@ class qtype_ddmarker_walkthrough_test extends qbehaviour_walkthrough_test_base { $this->get_contains_draggable_marker_home_expectation(1, false), $this->get_contains_draggable_marker_home_expectation(2, false), $this->get_contains_draggable_marker_home_expectation(3, false), - $this->get_contains_submit_button_expectation(false), + $this->get_does_not_contain_submit_button_expectation(), $this->get_contains_try_again_button_expectation(true), $this->get_does_not_contain_correctness_expectation(), $this->get_contains_hint_expectation('This is the first hint'), @@ -448,7 +448,7 @@ class qtype_ddmarker_walkthrough_test extends qbehaviour_walkthrough_test_base { $this->get_contains_draggable_marker_home_expectation(1, false), $this->get_contains_draggable_marker_home_expectation(2, false), $this->get_contains_draggable_marker_home_expectation(3, false), - $this->get_contains_submit_button_expectation(false), + $this->get_does_not_contain_submit_button_expectation(), $this->get_contains_try_again_button_expectation(true), $this->get_does_not_contain_correctness_expectation(), $this->get_contains_hint_expectation('This is the second hint'), @@ -493,7 +493,7 @@ class qtype_ddmarker_walkthrough_test extends qbehaviour_walkthrough_test_base { $this->get_contains_hidden_expectation(1, '50,50'), $this->get_contains_hidden_expectation(2, '150,50'), $this->get_contains_hidden_expectation(3, '100,150'), - $this->get_contains_submit_button_expectation(false), + $this->get_does_not_contain_submit_button_expectation(), $this->get_does_not_contain_try_again_button_expectation(), $this->get_contains_correct_expectation(), $this->get_no_hint_visible_expectation(), @@ -542,7 +542,7 @@ class qtype_ddmarker_walkthrough_test extends qbehaviour_walkthrough_test_base { $this->get_contains_draggable_marker_home_expectation(1, false), $this->get_contains_draggable_marker_home_expectation(2, false), $this->get_contains_draggable_marker_home_expectation(3, false), - $this->get_contains_submit_button_expectation(false), + $this->get_does_not_contain_submit_button_expectation(), $this->get_contains_correct_expectation(), $this->get_no_hint_visible_expectation()); @@ -597,7 +597,7 @@ class qtype_ddmarker_walkthrough_test extends qbehaviour_walkthrough_test_base { $this->get_contains_draggable_marker_home_expectation(1, false), $this->get_contains_draggable_marker_home_expectation(2, false), $this->get_contains_draggable_marker_home_expectation(3, false), - $this->get_contains_submit_button_expectation(false), + $this->get_does_not_contain_submit_button_expectation(), $this->get_contains_partcorrect_expectation(), $this->get_no_hint_visible_expectation()); @@ -651,7 +651,7 @@ class qtype_ddmarker_walkthrough_test extends qbehaviour_walkthrough_test_base { $this->get_contains_draggable_marker_home_expectation(1, false), $this->get_contains_draggable_marker_home_expectation(2, false), $this->get_contains_draggable_marker_home_expectation(3, false), - $this->get_contains_submit_button_expectation(false), + $this->get_does_not_contain_submit_button_expectation(), $this->get_contains_hint_expectation('This is the first hint')); // Do try again. diff --git a/question/type/ddwtos/tests/walkthrough_test.php b/question/type/ddwtos/tests/walkthrough_test.php index f56bae971c4..a50db1b9f78 100644 --- a/question/type/ddwtos/tests/walkthrough_test.php +++ b/question/type/ddwtos/tests/walkthrough_test.php @@ -114,7 +114,7 @@ class qtype_ddwtos_walkthrough_test extends qbehaviour_walkthrough_test_base { $this->get_contains_drop_box_expectation('1', 1, true), $this->get_contains_drop_box_expectation('2', 2, true), $this->get_contains_drop_box_expectation('3', 3, true), - $this->get_contains_submit_button_expectation(false), + $this->get_does_not_contain_submit_button_expectation(), $this->get_contains_try_again_button_expectation(true), $this->get_does_not_contain_correctness_expectation(), $this->get_contains_hint_expectation('This is the first hint')); @@ -151,7 +151,7 @@ class qtype_ddwtos_walkthrough_test extends qbehaviour_walkthrough_test_base { $this->get_contains_drop_box_expectation('1', 1, true, 'correct'), $this->get_contains_drop_box_expectation('2', 2, true, 'correct'), $this->get_contains_drop_box_expectation('3', 3, true, 'correct'), - $this->get_contains_submit_button_expectation(false), + $this->get_does_not_contain_submit_button_expectation(), $this->get_contains_correct_expectation(), $this->get_no_hint_visible_expectation()); @@ -401,7 +401,7 @@ class qtype_ddwtos_walkthrough_test extends qbehaviour_walkthrough_test_base { $this->get_contains_drop_box_expectation('1', 1, true), $this->get_contains_drop_box_expectation('2', 2, true), $this->get_contains_drop_box_expectation('3', 3, true), - $this->get_contains_submit_button_expectation(false), + $this->get_does_not_contain_submit_button_expectation(), $this->get_contains_try_again_button_expectation(true), $this->get_does_not_contain_correctness_expectation(), $this->get_contains_hint_expectation('This is the first hint'), @@ -453,7 +453,7 @@ class qtype_ddwtos_walkthrough_test extends qbehaviour_walkthrough_test_base { $this->get_contains_drop_box_expectation('1', 1, true), $this->get_contains_drop_box_expectation('2', 2, true), $this->get_contains_drop_box_expectation('3', 3, true), - $this->get_contains_submit_button_expectation(false), + $this->get_does_not_contain_submit_button_expectation(), $this->get_contains_try_again_button_expectation(true), $this->get_does_not_contain_correctness_expectation(), $this->get_contains_hint_expectation('This is the second hint'), @@ -499,7 +499,7 @@ class qtype_ddwtos_walkthrough_test extends qbehaviour_walkthrough_test_base { $this->get_contains_drop_box_expectation('1', 1, true, 'correct'), $this->get_contains_drop_box_expectation('2', 2, true, 'correct'), $this->get_contains_drop_box_expectation('3', 3, true, 'correct'), - $this->get_contains_submit_button_expectation(false), + $this->get_does_not_contain_submit_button_expectation(), $this->get_does_not_contain_try_again_button_expectation(), $this->get_contains_correct_expectation(), $this->get_no_hint_visible_expectation(), @@ -557,7 +557,7 @@ class qtype_ddwtos_walkthrough_test extends qbehaviour_walkthrough_test_base { $this->get_contains_drop_box_expectation('1', 1, true, 'correct'), $this->get_contains_drop_box_expectation('2', 2, true, 'correct'), $this->get_contains_drop_box_expectation('3', 3, true, 'correct'), - $this->get_contains_submit_button_expectation(false), + $this->get_does_not_contain_submit_button_expectation(), $this->get_contains_correct_expectation(), $this->get_no_hint_visible_expectation()); @@ -613,7 +613,7 @@ class qtype_ddwtos_walkthrough_test extends qbehaviour_walkthrough_test_base { $this->get_contains_drop_box_expectation('1', 1, true, 'correct'), $this->get_contains_drop_box_expectation('2', 2, true, 'incorrect'), $this->get_contains_drop_box_expectation('3', 3, true, 'incorrect'), - $this->get_contains_submit_button_expectation(false), + $this->get_does_not_contain_submit_button_expectation(), $this->get_contains_partcorrect_expectation(), $this->get_no_hint_visible_expectation()); @@ -666,7 +666,7 @@ class qtype_ddwtos_walkthrough_test extends qbehaviour_walkthrough_test_base { $this->get_contains_drop_box_expectation('1', 1, true), $this->get_contains_drop_box_expectation('2', 2, true), $this->get_contains_drop_box_expectation('3', 3, true), - $this->get_contains_submit_button_expectation(false), + $this->get_does_not_contain_submit_button_expectation(), $this->get_contains_hint_expectation('This is the first hint')); // Do try again. diff --git a/question/type/gapselect/tests/walkthrough_test.php b/question/type/gapselect/tests/walkthrough_test.php index 521d386a63d..b51b439a4e7 100644 --- a/question/type/gapselect/tests/walkthrough_test.php +++ b/question/type/gapselect/tests/walkthrough_test.php @@ -95,7 +95,7 @@ class qtype_gapselect_walkthrough_test extends qbehaviour_walkthrough_test_base array('' => get_string('choosedots'), '1' => 'fox', '2' => 'dog'), 2, false), $this->get_contains_select_expectation('p3', array('' => get_string('choosedots'), '1' => 'lazy', '2' => 'assiduous'), 2, false), - $this->get_contains_submit_button_expectation(false), + $this->get_does_not_contain_submit_button_expectation(), $this->get_contains_try_again_button_expectation(true), $this->get_does_not_contain_correctness_expectation(), $this->get_contains_hint_expectation('This is the first hint')); @@ -132,7 +132,7 @@ class qtype_gapselect_walkthrough_test extends qbehaviour_walkthrough_test_base array('' => get_string('choosedots'), '1' => 'fox', '2' => 'dog'), 1, false), $this->get_contains_select_expectation('p3', array('' => get_string('choosedots'), '1' => 'lazy', '2' => 'assiduous'), 1, false), - $this->get_contains_submit_button_expectation(false), + $this->get_does_not_contain_submit_button_expectation(), $this->get_contains_correct_expectation(), $this->get_no_hint_visible_expectation()); diff --git a/question/type/match/tests/walkthrough_test.php b/question/type/match/tests/walkthrough_test.php index a67a9424ec5..403d8d3b879 100644 --- a/question/type/match/tests/walkthrough_test.php +++ b/question/type/match/tests/walkthrough_test.php @@ -194,7 +194,7 @@ class qtype_match_walkthrough_test extends qbehaviour_walkthrough_test_base { $this->get_contains_select_expectation('sub1', $choices, $orderforchoice[2], false), $this->get_contains_select_expectation('sub2', $choices, $orderforchoice[2], false), $this->get_contains_select_expectation('sub3', $choices, $orderforchoice[1], false), - $this->get_contains_submit_button_expectation(false), + $this->get_does_not_contain_submit_button_expectation(), $this->get_contains_correct_expectation(), $this->get_no_hint_visible_expectation()); } @@ -246,7 +246,7 @@ class qtype_match_walkthrough_test extends qbehaviour_walkthrough_test_base { $this->get_contains_select_expectation('sub1', $choices, $orderforchoice[2], false), $this->get_contains_select_expectation('sub2', $choices, $orderforchoice[1], false), $this->get_contains_select_expectation('sub3', $choices, null, false), - $this->get_contains_submit_button_expectation(false), + $this->get_does_not_contain_submit_button_expectation(), $this->get_contains_partcorrect_expectation(), $this->get_no_hint_visible_expectation()); } @@ -313,7 +313,7 @@ class qtype_match_walkthrough_test extends qbehaviour_walkthrough_test_base { $this->get_contains_select_expectation('sub1', $choices, $orderforchoice[2], false), $this->get_contains_select_expectation('sub2', $choices, $orderforchoice[2], false), $this->get_contains_select_expectation('sub3', $choices, $orderforchoice[1], false), - $this->get_contains_submit_button_expectation(false), + $this->get_does_not_contain_submit_button_expectation(), $this->get_contains_correct_expectation(), $this->get_no_hint_visible_expectation()); } @@ -422,7 +422,7 @@ class qtype_match_walkthrough_test extends qbehaviour_walkthrough_test_base { $this->quba->get_field_prefix($this->slot) . 'sub2', '0'), $this->get_contains_hidden_expectation( $this->quba->get_field_prefix($this->slot) . 'sub3', '0'), - $this->get_contains_submit_button_expectation(false), + $this->get_does_not_contain_submit_button_expectation(), $this->get_contains_hint_expectation('This is the first hint.')); // Try again. @@ -464,7 +464,7 @@ class qtype_match_walkthrough_test extends qbehaviour_walkthrough_test_base { $this->quba->get_field_prefix($this->slot) . 'sub2', $orderforchoice[2]), $this->get_contains_hidden_expectation( $this->quba->get_field_prefix($this->slot) . 'sub3', $orderforchoice[1]), - $this->get_contains_submit_button_expectation(false), + $this->get_does_not_contain_submit_button_expectation(), $this->get_contains_hint_expectation('This is the second hint.')); // Try again. diff --git a/question/type/multianswer/tests/walkthrough_test.php b/question/type/multianswer/tests/walkthrough_test.php index cb07b3f6786..a7b7e843631 100644 --- a/question/type/multianswer/tests/walkthrough_test.php +++ b/question/type/multianswer/tests/walkthrough_test.php @@ -250,7 +250,7 @@ class qtype_multianswer_walkthrough_test extends qbehaviour_walkthrough_test_bas $this->quba->get_field_prefix($this->slot) . 'sub3_answer', ''), $this->get_contains_hidden_expectation( $this->quba->get_field_prefix($this->slot) . 'sub4_answer', ''), - $this->get_contains_submit_button_expectation(false), + $this->get_does_not_contain_submit_button_expectation(), $this->get_contains_try_again_button_expectation(true), $this->get_does_not_contain_correctness_expectation(), $this->get_contains_hint_expectation('This is the first hint.')); @@ -300,7 +300,7 @@ class qtype_multianswer_walkthrough_test extends qbehaviour_walkthrough_test_bas $this->quba->get_field_prefix($this->slot) . 'sub3_answer', ''), $this->get_contains_hidden_expectation( $this->quba->get_field_prefix($this->slot) . 'sub4_answer', '1'), - $this->get_contains_submit_button_expectation(false), + $this->get_does_not_contain_submit_button_expectation(), $this->get_contains_hint_expectation('This is the second hint.')); // Try again. @@ -419,7 +419,7 @@ class qtype_multianswer_walkthrough_test extends qbehaviour_walkthrough_test_bas $this->get_contains_select_expectation('sub2_answer', $choices, 1, false), $this->get_contains_select_expectation('sub3_answer', $choices, 1, false), $this->get_contains_select_expectation('sub4_answer', $choices, 1, false), - $this->get_contains_submit_button_expectation(false), + $this->get_does_not_contain_submit_button_expectation(), $this->get_contains_try_again_button_expectation(true), $this->get_does_not_contain_correctness_expectation(), new question_pattern_expectation('/Tries remaining: 2/'), @@ -460,7 +460,7 @@ class qtype_multianswer_walkthrough_test extends qbehaviour_walkthrough_test_bas $this->get_contains_select_expectation('sub2_answer', $choices, '1', false), $this->get_contains_select_expectation('sub3_answer', $choices, '0', false), $this->get_contains_select_expectation('sub4_answer', $choices, '1', false), - $this->get_contains_submit_button_expectation(false), + $this->get_does_not_contain_submit_button_expectation(), $this->get_does_not_contain_try_again_button_expectation(), $this->get_contains_correct_expectation(), new question_no_pattern_expectation('/class="control\b[^"]*\bpartiallycorrect"/')); diff --git a/question/type/numerical/tests/walkthrough_test.php b/question/type/numerical/tests/walkthrough_test.php index db735507a40..0d95cc028b8 100644 --- a/question/type/numerical/tests/walkthrough_test.php +++ b/question/type/numerical/tests/walkthrough_test.php @@ -97,7 +97,7 @@ class qtype_numerical_walkthrough_test extends qbehaviour_walkthrough_test_base $this->check_current_mark(3); $this->check_current_output( $this->get_contains_mark_summary(3), - $this->get_contains_submit_button_expectation(false), + $this->get_does_not_contain_submit_button_expectation(), $this->get_contains_correct_expectation(), $this->get_does_not_contain_validation_error_expectation(), $this->get_no_hint_visible_expectation()); diff --git a/question/type/randomsamatch/tests/walkthrough_test.php b/question/type/randomsamatch/tests/walkthrough_test.php index 07c26439c4c..dfaa54bdfb4 100644 --- a/question/type/randomsamatch/tests/walkthrough_test.php +++ b/question/type/randomsamatch/tests/walkthrough_test.php @@ -193,7 +193,7 @@ class qtype_randomsamatch_walkthrough_test extends qbehaviour_walkthrough_test_b $this->get_contains_select_expectation('sub1', $choices, $orderforchoice[16], false), $this->get_contains_select_expectation('sub2', $choices, $orderforchoice[16], false), $this->get_contains_select_expectation('sub3', $choices, $orderforchoice[13], false), - $this->get_contains_submit_button_expectation(false), + $this->get_does_not_contain_submit_button_expectation(), $this->get_contains_correct_expectation(), $this->get_no_hint_visible_expectation()); } @@ -245,7 +245,7 @@ class qtype_randomsamatch_walkthrough_test extends qbehaviour_walkthrough_test_b $this->get_contains_select_expectation('sub1', $choices, $orderforchoice[16], false), $this->get_contains_select_expectation('sub2', $choices, $orderforchoice[13], false), $this->get_contains_select_expectation('sub3', $choices, null, false), - $this->get_contains_submit_button_expectation(false), + $this->get_does_not_contain_submit_button_expectation(), $this->get_contains_partcorrect_expectation(), $this->get_no_hint_visible_expectation()); } @@ -312,7 +312,7 @@ class qtype_randomsamatch_walkthrough_test extends qbehaviour_walkthrough_test_b $this->get_contains_select_expectation('sub1', $choices, $orderforchoice[16], false), $this->get_contains_select_expectation('sub2', $choices, $orderforchoice[16], false), $this->get_contains_select_expectation('sub3', $choices, $orderforchoice[13], false), - $this->get_contains_submit_button_expectation(false), + $this->get_does_not_contain_submit_button_expectation(), $this->get_contains_correct_expectation(), $this->get_no_hint_visible_expectation()); } @@ -369,7 +369,7 @@ class qtype_randomsamatch_walkthrough_test extends qbehaviour_walkthrough_test_b $this->quba->get_field_prefix($this->slot) . 'sub2', '0'), $this->get_contains_hidden_expectation( $this->quba->get_field_prefix($this->slot) . 'sub3', '0'), - $this->get_contains_submit_button_expectation(false), + $this->get_does_not_contain_submit_button_expectation(), $this->get_contains_hint_expectation('This is the first hint.')); // Try again. @@ -411,7 +411,7 @@ class qtype_randomsamatch_walkthrough_test extends qbehaviour_walkthrough_test_b $this->quba->get_field_prefix($this->slot) . 'sub2', $orderforchoice[16]), $this->get_contains_hidden_expectation( $this->quba->get_field_prefix($this->slot) . 'sub3', $orderforchoice[13]), - $this->get_contains_submit_button_expectation(false), + $this->get_does_not_contain_submit_button_expectation(), $this->get_contains_hint_expectation('This is the second hint.')); // Try again.