diff --git a/question/behaviour/adaptivenopenalty/renderer.php b/question/behaviour/adaptivenopenalty/renderer.php index 34d3ae184f8..62b95401c15 100644 --- a/question/behaviour/adaptivenopenalty/renderer.php +++ b/question/behaviour/adaptivenopenalty/renderer.php @@ -38,9 +38,11 @@ require_once(dirname(__FILE__) . '/../adaptive/renderer.php'); * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ class qbehaviour_adaptivenopenalty_renderer extends qbehaviour_adaptive_renderer { - protected function penalty_info(qbehaviour_adaptive_mark_details $details, question_display_options $options) { - return ''; + protected function grading_details(qbehaviour_adaptive_mark_details $details, question_display_options $options) { + $mark = $details->get_formatted_marks($options->markdp); + return get_string('gradingdetails', 'qbehaviour_adaptive', $mark); } + protected function disregarded_info() { return ''; } diff --git a/question/behaviour/adaptivenopenalty/tests/walkthrough_test.php b/question/behaviour/adaptivenopenalty/tests/walkthrough_test.php index aebbcf7a9c0..c8de4385536 100644 --- a/question/behaviour/adaptivenopenalty/tests/walkthrough_test.php +++ b/question/behaviour/adaptivenopenalty/tests/walkthrough_test.php @@ -44,6 +44,18 @@ class qbehaviour_adaptivenopenalty_walkthrough_test extends qbehaviour_walkthrou return new question_no_pattern_expectation('/class="gradingdetails"/'); } + protected function get_does_not_contain_penalty_info_expectation() { + $penaltyinfo = get_string('gradingdetailspenalty', 'qbehaviour_adaptive', 'XXXXX'); + $penaltypattern = '/'.str_replace('XXXXX', '\\w*', preg_quote($penaltyinfo, '/')).'/'; + return new question_no_pattern_expectation($penaltypattern); + } + + protected function get_does_not_contain_total_penalty_expectation() { + $penaltyinfo = get_string('gradingdetailspenaltytotal', 'qbehaviour_adaptive', 'XXXXX'); + $penaltypattern = '/'.str_replace('XXXXX', '\\w*', preg_quote($penaltyinfo, '/')).'/'; + return new question_no_pattern_expectation($penaltypattern); + } + public function test_multichoice() { // Create a multiple choice, single response question. @@ -77,7 +89,9 @@ class qbehaviour_adaptivenopenalty_walkthrough_test extends qbehaviour_walkthrou $this->get_contains_mc_radio_expectation($wrongindex, true, true), $this->get_contains_mc_radio_expectation(($wrongindex + 1) % 3, true, false), $this->get_contains_mc_radio_expectation(($wrongindex + 2) % 3, true, false), - $this->get_contains_incorrect_expectation()); + $this->get_contains_incorrect_expectation(), + $this->get_does_not_contain_penalty_info_expectation(), + $this->get_does_not_contain_total_penalty_expectation()); $this->assertRegExp('/B|C/', $this->quba->get_response_summary($this->slot)); @@ -106,7 +120,9 @@ class qbehaviour_adaptivenopenalty_walkthrough_test extends qbehaviour_walkthrou $this->get_contains_mc_radio_expectation($rightindex, true, true), $this->get_contains_mc_radio_expectation(($rightindex + 1) % 3, true, false), $this->get_contains_mc_radio_expectation(($rightindex + 2) % 3, true, false), - $this->get_contains_correct_expectation()); + $this->get_contains_correct_expectation(), + $this->get_does_not_contain_penalty_info_expectation(), + $this->get_does_not_contain_total_penalty_expectation()); $this->assertEquals('A', $this->quba->get_response_summary($this->slot)); @@ -176,7 +192,9 @@ class qbehaviour_adaptivenopenalty_walkthrough_test extends qbehaviour_walkthrou $this->check_current_output( $this->get_contains_mark_summary(2), $this->get_contains_submit_button_expectation(true), - $this->get_contains_correct_expectation()); + $this->get_contains_correct_expectation(), + $this->get_does_not_contain_penalty_info_expectation(), + $this->get_does_not_contain_total_penalty_expectation()); // Save the same correct answer again. Should no do anything. $numsteps = $this->get_step_count(); @@ -237,6 +255,8 @@ class qbehaviour_adaptivenopenalty_walkthrough_test extends qbehaviour_walkthrou $this->get_contains_mark_summary(0), $this->get_contains_submit_button_expectation(true), $this->get_contains_incorrect_expectation(), + $this->get_does_not_contain_penalty_info_expectation(), + $this->get_does_not_contain_total_penalty_expectation(), $this->get_does_not_contain_validation_error_expectation()); // Submit another non-numerical answer.