From b8a9ea452fcbe87cec0b24fb6871009fa096ec19 Mon Sep 17 00:00:00 2001 From: Romain Quetiez Date: Thu, 13 Jun 2024 11:31:58 +0200 Subject: [PATCH] :white_check_mark: Fix interferences between tests on dictionaries --- .../DictionariesConsistencyAfterSetupTest.php | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/tests/php-unit-tests/integration-tests/DictionariesConsistencyAfterSetupTest.php b/tests/php-unit-tests/integration-tests/DictionariesConsistencyAfterSetupTest.php index bd07f9ea6..6e854fb13 100644 --- a/tests/php-unit-tests/integration-tests/DictionariesConsistencyAfterSetupTest.php +++ b/tests/php-unit-tests/integration-tests/DictionariesConsistencyAfterSetupTest.php @@ -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' => [