MDL-61619 phpunit: phpunit test confirming bug in new xmlize code

This commit is contained in:
Jake Dallimore
2018-03-12 11:11:58 +08:00
parent 1287039e62
commit 0c23f4e6b6
3 changed files with 121 additions and 0 deletions
+12
View File
@@ -56,4 +56,16 @@ class core_xmlize_testcase extends basic_testcase {
$this->expectExceptionMessage('Error parsing XML: Mismatched tag at line 18, char 23');
$xmlnew = xmlize($xml, 1, "UTF-8", true);
}
/**
* Test an XML import using legacy question data with old image tag.
*/
public function test_xmlimport_of_sample_question_with_old_image_tag() {
$xml = file_get_contents(__DIR__ . '/sample_questions_with_old_image_tag.xml');
$serialised = file_get_contents(__DIR__ . '/sample_questions_with_old_image_tag.ser');
// Compare the legacy representation in its serialized state and after unserialization.
$this->assertEquals($serialised, serialize(xmlize($xml)));
$this->assertEquals(unserialize($serialised), xmlize($xml));
}
}