Merge branch 'MDL-86425-501' of https://github.com/sh-csg/moodle into MOODLE_501_STABLE

This commit is contained in:
Huong Nguyen
2025-12-02 10:32:28 +07:00
2 changed files with 19 additions and 0 deletions
@@ -282,6 +282,24 @@ final class writer_test extends \basic_testcase {
$result = $xo->get_allcontents();
$this->assertEquals($result, '<tagname attrname="attrvalue" /><tagname2 attrname="attrvalue">testsomecontent</tagname2>');
// Test nullcontent reset.
$xo = new memory_xml_output();
$xw = new mock_xml_writer($xo);
$xw->set_prologue('');
$xw->start();
$xw->full_tag('tagname', null);
$xw->begin_tag('tagname2');
$xw->full_tag('tagname3', 'somecontent');
$xw->end_tag('tagname2');
$xw->stop();
$result = $xo->get_allcontents();
$expected = <<<XML
<tagname /><tagname2>
<tagname3>somecontent</tagname3>
</tagname2>
XML;
$this->assertEquals($expected, $result);
// Build a complex XML file and test results against stored file in fixtures
$xo = new memory_xml_output();
$xw = new mock_xml_writer($xo);
@@ -216,6 +216,7 @@ class xml_writer {
$this->lastwastext = true;
$this->end_tag($tag);
}
$this->nullcontent = false; // Reset nullcontent flag.
}