Skip to content

Commit

Permalink
Regression: testing_outcome was giving php errors with newer PHP vers…
Browse files Browse the repository at this point in the history
…ions.
  • Loading branch information
trampgeek committed Aug 23, 2024
1 parent 1a0332c commit 0dd1e51
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions classes/testing_outcome.php
Original file line number Diff line number Diff line change
Expand Up @@ -233,19 +233,23 @@ protected function format_failed_test($rownum, $code, $expected, $got, $sanitise
'#id_testcode_' . $rownum,
get_string('testcase', 'qtype_coderunner', $rownum + 1)
) . "$nl<pre>$code</pre>";
$expected = html_writer::link(
$expectedlink = html_writer::link(
'#id_expected_' . $rownum,
html_writer::tag(
'pre',
$expected,
$expected instanceof qtype_coderunner_html_wrapper ? $expected->value() : $expected,
['id' => 'id_fail_expected_' . $rownum]
)
);
$gotpre = html_writer::tag('pre', $got, ['id' => 'id_got_' . $rownum]);
$gotpre = html_writer::tag(
'pre',
$got instanceof qtype_coderunner_html_wrapper ? $got->value() : $got,
['id' => 'id_got_' . $rownum]
);
$button = html_writer::tag('button', '&lt;&lt;', [
'type' => 'button', // To suppress form submission.
'class' => 'replaceexpectedwithgot']);
return [$testcode, $expected, $gotpre . $button];
return [$testcode, $expectedlink, $gotpre . $button];
}

// Return a message summarising the nature of the error if this outcome
Expand Down

0 comments on commit 0dd1e51

Please sign in to comment.