MDL-68149 qtype_match: Updatey tests to follow make_question() pattern

This commit is contained in:
Tim Hunt
2020-03-11 13:41:13 +00:00
parent 9df2f66fb4
commit b060e7495c
6 changed files with 57 additions and 46 deletions
+1 -23
View File
@@ -375,29 +375,7 @@ class test_question_maker {
* @return qtype_match_question
*/
public static function make_a_matching_question() {
question_bank::load_question_definition_classes('match');
$match = new qtype_match_question();
self::initialise_a_question($match);
$match->name = 'Matching question';
$match->questiontext = 'Classify the animals.';
$match->generalfeedback = 'Frogs and toads are amphibians, the others are mammals.';
$match->qtype = question_bank::get_qtype('match');
$match->shufflestems = 1;
self::set_standard_combined_feedback_fields($match);
// Using unset to get 1-based arrays.
$match->stems = array('', 'Dog', 'Frog', 'Toad', 'Cat');
$match->stemformat = array('', FORMAT_HTML, FORMAT_HTML, FORMAT_HTML, FORMAT_HTML);
$match->choices = array('', 'Mammal', 'Amphibian', 'Insect');
$match->right = array('', 1, 2, 2, 1);
unset($match->stems[0]);
unset($match->stemformat[0]);
unset($match->choices[0]);
unset($match->right[0]);
return $match;
return self::make_question('match');
}
/**