Merge branch 'MDL-43690' of git://github.com/timhunt/moodle
This commit is contained in:
@@ -1018,7 +1018,7 @@ function quiz_question_tostring($question, $showicon = false,
|
||||
$questiontext = shorten_text($questiontext, 200);
|
||||
$result .= '<span class="questiontext">';
|
||||
if (!empty($questiontext)) {
|
||||
$result .= $questiontext;
|
||||
$result .= s($questiontext);
|
||||
} else {
|
||||
$result .= '<span class="error">';
|
||||
$result .= get_string('questiontextisempty', 'quiz');
|
||||
|
||||
@@ -82,4 +82,16 @@ class mod_quiz_editlib_testcase extends basic_testcase {
|
||||
$this->assertEquals(quiz_add_page_break_at('1,2,0', 2), '1,2,0,0');
|
||||
$this->assertEquals(quiz_add_page_break_at('1,2,0', 3), '1,2,0');
|
||||
}
|
||||
|
||||
public function test_quiz_question_tostring() {
|
||||
$question = new stdClass();
|
||||
$question->qtype = 'multichoice';
|
||||
$question->name = 'The question name';
|
||||
$question->questiontext = '<p>What sort of <b>inequality</b> is x < y<img alt="?" src="..."></p>';
|
||||
$question->questiontextformat = FORMAT_HTML;
|
||||
|
||||
$summary = quiz_question_tostring($question);
|
||||
$this->assertEquals('<span class="questionname">The question name</span>' .
|
||||
'<span class="questiontext">What sort of INEQUALITY is x < y[?]</span>', $summary);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user