Fix interferences between tests on dictionaries

This commit is contained in:
Romain Quetiez
2024-06-13 11:31:58 +02:00
parent c8a1f7f534
commit b8a9ea452f

View File

@@ -19,6 +19,20 @@ class DictionariesConsistencyAfterSetupTest extends ItopTestCase
"Class:TriggerOnThresholdReached/Attribute:threshold_index+"
];
protected function setUp(): void
{
parent::setUp(); // TODO: Change the autogenerated stub
// Cleanup the entry 'ITOP::DICT:FORMAT:BROKEN:KEY' introduced by some dirty tests
$aDictEntriesByLanguage = $this->GetNonPublicStaticProperty(\Dict::class, 'm_aData', []);
foreach ($aDictEntriesByLanguage as $sLangCode => &$aDictEntries) {
if (array_key_exists('ITOP::DICT:FORMAT:BROKEN:KEY', $aDictEntries)) {
unset($aDictEntries['ITOP::DICT:FORMAT:BROKEN:KEY']);
}
}
$this->SetNonPublicStaticProperty(\Dict::class, 'm_aData', $aDictEntriesByLanguage);
}
public function FormatProvider(){
return [
'key does not exist in dictionnary' => [