Merge branch 'MDL-41600' of git://github.com/aolley/moodle

This commit is contained in:
Sam Hemelryk
2013-09-10 13:12:13 +12:00
2 changed files with 30 additions and 4 deletions
@@ -56,8 +56,12 @@ class qformat_blackboard_six_pool_test extends question_testcase {
$q = $questions[5];
// If qtype_ddmatch is installed, the formatter produces ddmatch
// qtypes, not match ones.
$ddmatchisinstalled = question_bank::is_qtype_installed('ddmatch');
$expectedq = new stdClass();
$expectedq->qtype = 'match';
$expectedq->qtype = $ddmatchisinstalled ? 'ddmatch' : 'match';
$expectedq->name = 'Classify the animals.';
$expectedq->questiontext = '<i>Classify the animals.</i>';
$expectedq->questiontextformat = FORMAT_HTML;
@@ -78,8 +82,17 @@ class qformat_blackboard_six_pool_test extends question_testcase {
array('text' => '', 'format' => FORMAT_HTML),
array('text' => 'frog', 'format' => FORMAT_HTML),
array('text' => 'newt', 'format' => FORMAT_HTML));
$expectedq->subanswers = array('mammal', 'insect', 'amphibian', 'amphibian');
if ($ddmatchisinstalled) {
$expectedq->subanswers = array(
array('text' => 'mammal', 'format' => FORMAT_HTML),
array('text' => 'insect', 'format' => FORMAT_HTML),
array('text' => 'amphibian', 'format' => FORMAT_HTML),
array('text' => 'amphibian', 'format' => FORMAT_HTML),
);
} else {
$expectedq->subanswers = array('mammal', 'insect', 'amphibian', 'amphibian');
}
$this->assert(new question_check_specified_fields_expectation($expectedq), $q);
}
@@ -53,8 +53,12 @@ class qformat_blackboard_six_qti_test extends question_testcase {
$questions = $importer->readquestions($xml);
$q = $questions[4];
// If qtype_ddmatch is installed, the formatter produces ddmatch
// qtypes, not match ones.
$ddmatchisinstalled = question_bank::is_qtype_installed('ddmatch');
$expectedq = new stdClass();
$expectedq->qtype = 'match';
$expectedq->qtype = $ddmatchisinstalled ? 'ddmatch' : 'match';
$expectedq->name = 'Classify the animals.';
$expectedq->questiontext = 'Classify the animals.';
$expectedq->questiontextformat = FORMAT_HTML;
@@ -75,7 +79,16 @@ class qformat_blackboard_six_qti_test extends question_testcase {
array('text' => 'cat', 'format' => FORMAT_HTML),
array('text' => 'frog', 'format' => FORMAT_HTML),
array('text' => 'newt', 'format' => FORMAT_HTML));
$expectedq->subanswers = array('insect', 'mammal', 'amphibian', 'amphibian');
if ($ddmatchisinstalled) {
$expectedq->subanswers = array(
array('text' => 'insect', 'format' => FORMAT_HTML),
array('text' => 'mammal', 'format' => FORMAT_HTML),
array('text' => 'amphibian', 'format' => FORMAT_HTML),
array('text' => 'amphibian', 'format' => FORMAT_HTML),
);
} else {
$expectedq->subanswers = array('insect', 'mammal', 'amphibian', 'amphibian');
}
$this->assert(new question_check_specified_fields_expectation($expectedq), $q);
}