N°9066 - Serialization/Unserialization from XML to Forms

This commit is contained in:
Eric Espie
2026-01-07 14:29:08 +01:00
parent efb1bd765b
commit 154fb5c737
23 changed files with 553 additions and 112 deletions

View File

@@ -64,36 +64,6 @@ class ModelFactoryTest extends ItopTestCase
return $oFactory;
}
/**
* @param $sXML
*
* @return false|string
*/
protected function CanonicalizeXML($sXML)
{
// Canonicalize the expected XML (to cope with indentation)
$oExpectedDocument = new DOMDocument();
$oExpectedDocument->preserveWhiteSpace = false;
$oExpectedDocument->formatOutput = true;
$oExpectedDocument->loadXML($sXML);
$sSavedXML = $oExpectedDocument->SaveXML();
return str_replace(' encoding="UTF-8"', '', $sSavedXML);
}
/**
* @param $sExpected
* @param $sActual
* @param string $sMessage
*/
protected function AssertEqualiTopXML($sExpected, $sActual, string $sMessage = '')
{
// Note: assertEquals reports the differences in a diff which is easier to interpret (in PHPStorm)
// as compared to the report given by assertEqualXMLStructure
static::assertEquals($this->CanonicalizeXML($sExpected), $this->CanonicalizeXML($sActual), $sMessage);
}
/**
* Assertion ignoring some of the unexpected decoration brought by DOM Elements.
*/