Merge remote-tracking branch 'origin/support/3.1' into develop

This commit is contained in:
Pierre Goiffon
2023-08-01 14:39:28 +02:00
2 changed files with 10 additions and 14 deletions

View File

@@ -898,7 +898,10 @@ class iTopDesignFormat
$oNodeList = $oXPath->query("/itop_design/classes//class/fields/field/values/value"); $oNodeList = $oXPath->query("/itop_design/classes//class/fields/field/values/value");
foreach ($oNodeList as $oNode) { foreach ($oNodeList as $oNode) {
$sCode = $oNode->textContent; $sCode = $oNode->textContent;
$oNode->textContent = ''; // N°6562 textContent is readonly, see https://www.php.net/manual/en/class.domnode.php#95545
// $oNode->textContent = '';
// N°6562 to update text node content we must use the node methods !
$oNode->removeChild($oNode->firstChild);
$oCodeNode = $oNode->ownerDocument->createElement("code", $sCode); $oCodeNode = $oNode->ownerDocument->createElement("code", $sCode);
$oNode->appendChild($oCodeNode); $oNode->appendChild($oCodeNode);
} }
@@ -988,7 +991,12 @@ class iTopDesignFormat
if ($oStyleNode) { if ($oStyleNode) {
$this->DeleteNode($oStyleNode); $this->DeleteNode($oStyleNode);
} }
$oNode->textContent = $sCode;
// N°6562 textContent is readonly, see https://www.php.net/manual/en/class.domnode.php#95545
// $oNode->textContent = $sCode;
// N°6562 to update text node content we must use the node methods !
$oTextContentNode = new DOMText($sCode);
$oNode->appendChild($oTextContentNode);
} }
} }
// - Style // - Style

View File

@@ -59,12 +59,6 @@ class iTopDesignFormatTest extends ItopTestCase
$sInputXml = $this->GetFileContent($sSamplesRelDirPath.$sXmlFileName.'.input'); $sInputXml = $this->GetFileContent($sSamplesRelDirPath.$sXmlFileName.'.input');
$oInputDesignFormat = static::GetItopFormatFromString($sInputXml); $oInputDesignFormat = static::GetItopFormatFromString($sInputXml);
// N°6562 Disable test for 1.7 => 3.0 conversion on PHP 8.1.21 / 8.2.8 as it is failing due to unknown reason. Cause will be investigated next week.
if ((PHP_VERSION_ID === 80121 || PHP_VERSION_ID === 80208)
&& $oInputDesignFormat->GetVersion() === "1.7" && $sTargetVersion === "3.0") {
$this->markTestSkipped("Skip test for 1.7 => 3.0 conversion on PHP 8.1.21 as it is failing due to unknown reason. Cause will be investigated next week.");
}
$bResult = $oInputDesignFormat->Convert($sTargetVersion); $bResult = $oInputDesignFormat->Convert($sTargetVersion);
$aErrors = $oInputDesignFormat->GetErrors(); $aErrors = $oInputDesignFormat->GetErrors();
$this->assertCount($iExpectedErrors, $aErrors, $this->assertCount($iExpectedErrors, $aErrors,
@@ -109,12 +103,6 @@ class iTopDesignFormatTest extends ItopTestCase
$oExpectedDesignFormat = static::GetItopFormatFromString($sExpectedXml); $oExpectedDesignFormat = static::GetItopFormatFromString($sExpectedXml);
$sExpectedVersion = $oExpectedDesignFormat->GetVersion(); $sExpectedVersion = $oExpectedDesignFormat->GetVersion();
// N°6562 Disable test for 1.7 => 3.0 conversion on PHP 8.1.21 / 8.2.8 as it is failing due to unknown reason. Cause will be investigated next week.
if ((PHP_VERSION_ID === 80121 || PHP_VERSION_ID === 80208)
&& $sInputVersion === "1.7" && $sExpectedVersion === "3.0") {
$this->markTestSkipped("Skip test for 1.7 => 3.0 conversion on PHP 8.1.21 as it is failing due to unknown reason. Cause will be investigated next week.");
}
if (version_compare($sInputVersion, $sExpectedVersion, '>=')) { if (version_compare($sInputVersion, $sExpectedVersion, '>=')) {
$this->markTestSkipped("This dataset correspond to a downward conversion ($sInputVersion to $sExpectedVersion) and we want to test upwards conversions => skipping !"); $this->markTestSkipped("This dataset correspond to a downward conversion ($sInputVersion to $sExpectedVersion) and we want to test upwards conversions => skipping !");
} }