N°8772 - Compiler: Add errors check

This commit is contained in:
Eric Espie
2025-12-11 14:10:50 +01:00
parent 41d15f1b33
commit 2b8de85af8
2 changed files with 41 additions and 1 deletions

View File

@@ -30,6 +30,8 @@ class Property extends AbstractProperty
$oValueTypeNode = $oDomNode->GetOptionalElement('value-type');
if ($oValueTypeNode) {
$this->oValueType = ValueTypeFactory::GetInstance()->CreateValueTypeFromDomNode($oValueTypeNode);
} else {
throw new PropertyTreeException("Node: {$this->sId}, missing value-type in node specification");
}
$this->sRelevanceCondition = $oDomNode->GetChildText('relevance-condition');
@@ -68,7 +70,7 @@ class Property extends AbstractProperty
}
$sBinding .= "\n ->AddInputDependsOn('{$sNode}.$sOutput', '$sNode', '$sOutput')";
} else {
// TODO Erreur field sans alias
throw new PropertyTreeException("Node: {$this->sId}, missing output or source in relevance condition: $sFieldToResolve");
}
}

View File

@@ -520,6 +520,44 @@ XML,
'sExpectedClass' => 'Combodo\iTop\PropertyTree\PropertyTreeException',
'sExpectedMessage' => 'Node: dependant_property, invalid output in relevance condition: source_property.text_output',
],
'Missing output or source in relevance condition' => [
'sXMLContent' => <<<XML
<?xml version="1.0" encoding="UTF-8"?>
<node id="RelevanceCondition" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="Combodo-PropertyTree" xsi:noNamespaceSchemaLocation = "https://www.combodo.com/itop-schema/3.3">
<nodes>
<node id="source_property" xsi:type="Combodo-Property">
<label>UI:Source</label>
<value-type xsi:type="Combodo-ValueTypeString">
</value-type>
</node>
<node id="dependant_property" xsi:type="Combodo-Property">
<label>UI:Dependant</label>
<relevance-condition>source_property != 'count'</relevance-condition>
<value-type xsi:type="Combodo-ValueTypeString">
</value-type>
</node>
</nodes>
</node>
XML,
'sExpectedClass' => 'Combodo\iTop\PropertyTree\PropertyTreeException',
'sExpectedMessage' => 'Node: dependant_property, missing output or source in relevance condition: source_property',
],
'Missing value-type in node specification' => [
'sXMLContent' => <<<XML
<?xml version="1.0" encoding="UTF-8"?>
<node id="RelevanceCondition" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="Combodo-PropertyTree" xsi:noNamespaceSchemaLocation = "https://www.combodo.com/itop-schema/3.3">
<nodes>
<node id="source_property" xsi:type="Combodo-Property">
<label>UI:Source</label>
</node>
</nodes>
</node>
XML,
'sExpectedClass' => 'Combodo\iTop\PropertyTree\PropertyTreeException',
'sExpectedMessage' => 'Node: source_property, missing value-type in node specification',
],
];
}
}