mirror of
https://github.com/Combodo/iTop.git
synced 2026-02-13 07:24:13 +01:00
N°9066 - Serialization/Unserialization from XML to Forms
This commit is contained in:
@@ -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.
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user