public function test_import_description() { $xml = ' <question type="description"> <name> <text>A description</text> </name> <questiontext format="html"> <text>The question text.</text> </questiontext> <generalfeedback> <text>Here is some general feedback.</text> </generalfeedback> <defaultgrade>0</defaultgrade> <penalty>0</penalty> <hidden>0</hidden> </question>'; $xmldata = xmlize($xml); $importer = new qformat_xml(); $q = $importer->import_description($xmldata['question']); $expectedq = new stdClass(); $expectedq->qtype = 'description'; $expectedq->name = 'A description'; $expectedq->questiontext = 'The question text.'; $expectedq->questiontextformat = FORMAT_HTML; $expectedq->generalfeedback = 'Here is some general feedback.'; $expectedq->defaultmark = 0; $expectedq->length = 0; $expectedq->penalty = 0; $this->assert(new question_check_specified_fields_expectation($expectedq), $q); }