mirror of
https://github.com/moodle/moodle.git
synced 2025-04-13 04:22:07 +02:00
Merge branch 'master_MDL-75874' of https://github.com/matheusot/moodle
This commit is contained in:
commit
1aba368aa9
@ -86,8 +86,7 @@ class qformat_aiken extends qformat_default {
|
||||
}
|
||||
|
||||
// A choice. Trim off the label and space, then save.
|
||||
$question->answer[] = $this->text_field(
|
||||
htmlspecialchars(trim(substr($nowline, 2)), ENT_NOQUOTES));
|
||||
$question->answer[] = $this->text_field(substr($nowline, 2));
|
||||
$question->fraction[] = 0;
|
||||
$question->feedback[] = $this->text_field('');
|
||||
} else if (preg_match('/^ANSWER:/', $nowline)) {
|
||||
|
@ -59,16 +59,19 @@ class aikenformat_test extends question_testcase {
|
||||
$this->assertStringContainsString('Error importing question A question started but not finished', $output);
|
||||
$this->assertStringContainsString('Question not completed before next question start on line 18', $output);
|
||||
|
||||
// There are two expected questions.
|
||||
$this->assertCount(2, $questions);
|
||||
// There are three expected questions.
|
||||
$this->assertCount(3, $questions);
|
||||
|
||||
$q1 = null;
|
||||
$q2 = null;
|
||||
$q3 = null;
|
||||
foreach ($questions as $question) {
|
||||
if ($question->name === 'A good question') {
|
||||
$q1 = $question;
|
||||
} else if ($question->name === 'A second good question') {
|
||||
$q2 = $question;
|
||||
} else if ($question->name === 'A third good question with HTML chars such as > < &') {
|
||||
$q3 = $question;
|
||||
}
|
||||
}
|
||||
|
||||
@ -83,5 +86,11 @@ class aikenformat_test extends question_testcase {
|
||||
$this->assertEquals(1, $q2->fraction[1]);
|
||||
$this->assertEquals('Incorrect (No space)', $q2->answer[0]['text']);
|
||||
$this->assertEquals('Correct (No space)', $q2->answer[1]['text']);
|
||||
|
||||
// Check the third good question that has anwsers with special HTML chars such as <, >, and &.
|
||||
$this->assertCount(2, $q3->answer);
|
||||
$this->assertEquals(1, $q3->fraction[0]);
|
||||
$this->assertEquals('Correct (< > &)', $q3->answer[0]['text']);
|
||||
$this->assertEquals('Incorrect (< > &)', $q3->answer[1]['text']);
|
||||
}
|
||||
}
|
||||
|
@ -18,4 +18,9 @@ B) Incorrect-ish
|
||||
A second good question
|
||||
A)Incorrect (No space)
|
||||
B)Correct (No space)
|
||||
ANSWER: B
|
||||
ANSWER: B
|
||||
|
||||
A third good question with HTML chars such as > < &
|
||||
A) Correct (< > &)
|
||||
B) Incorrect (< > &)
|
||||
ANSWER: A
|
Loading…
x
Reference in New Issue
Block a user