From 31e29506fa8f4ab799f64712b5a97d36316d14bc Mon Sep 17 00:00:00 2001 From: Pierre Goiffon Date: Tue, 16 Jan 2024 10:18:50 +0100 Subject: [PATCH 1/2] =?UTF-8?q?N=C2=B07143=20DictionariesConsistencyTest::?= =?UTF-8?q?testNoDictFileInDatamodelsModuleRootDirectory=20Add=20exclusion?= =?UTF-8?q?=20list=20to=20remove=20modules=20that=20must=20be=20compatible?= =?UTF-8?q?=20with=20iTop=202.7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../DictionariesConsistencyTest.php | 75 ++++++++++++++++++- 1 file changed, 73 insertions(+), 2 deletions(-) diff --git a/tests/php-unit-tests/integration-tests/DictionariesConsistencyTest.php b/tests/php-unit-tests/integration-tests/DictionariesConsistencyTest.php index 41772368c..cf35b88fd 100644 --- a/tests/php-unit-tests/integration-tests/DictionariesConsistencyTest.php +++ b/tests/php-unit-tests/integration-tests/DictionariesConsistencyTest.php @@ -189,12 +189,83 @@ class DictionariesConsistencyTest extends ItopTestCase $this->assertTrue(true); } + /** + * Since 3.0.0 and N°2969 it is possible to have a dictionaries directory in modules. We want to ensure that core modules use this functionality ! + * + * @since 2.7.11 3.0.5 3.1.2 3.2.0 N°7143 + */ public function testNoDictFileInDatamodelsModuleRootDirectory():void { $sAppRoot = static::GetAppRoot(); $aDictFilesInDatamodelsModuleRootDir = glob($sAppRoot.'datamodels/2.x/*/*.dict*.php'); - $this->assertNotFalse($aDictFilesInDatamodelsModuleRootDir, 'Searching for files returned an error'); + + $aExcludedModulesList = $this->GetLtsCompatibleModulesList(); + $aDictFilesInDatamodelsModuleRootDir = array_filter( + $aDictFilesInDatamodelsModuleRootDir, + function($sDictFileFullPath) use ($aExcludedModulesList) { + $sModuleFullPath = dirname($sDictFileFullPath); + $sModuleDirectory = basename($sModuleFullPath); + echo $sModuleDirectory; + return !in_array($sModuleDirectory, $aExcludedModulesList); + } + ); + + $sDictFilesInDatamodelsModuleRootDirList = var_export($aDictFilesInDatamodelsModuleRootDir, true); $this->assertCount(0, $aDictFilesInDatamodelsModuleRootDir, - "There are some files in datamodels module root dirs ! You must move them to the `dictionaries` module subfolder. \n List of files: ".var_export($aDictFilesInDatamodelsModuleRootDir, true)); + << Date: Tue, 16 Jan 2024 10:25:28 +0100 Subject: [PATCH 2/2] =?UTF-8?q?N=C2=B07143=20Woops=20removed=20forgotten?= =?UTF-8?q?=20echo?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../integration-tests/DictionariesConsistencyTest.php | 1 - 1 file changed, 1 deletion(-) diff --git a/tests/php-unit-tests/integration-tests/DictionariesConsistencyTest.php b/tests/php-unit-tests/integration-tests/DictionariesConsistencyTest.php index cf35b88fd..b5aaa35b2 100644 --- a/tests/php-unit-tests/integration-tests/DictionariesConsistencyTest.php +++ b/tests/php-unit-tests/integration-tests/DictionariesConsistencyTest.php @@ -205,7 +205,6 @@ class DictionariesConsistencyTest extends ItopTestCase function($sDictFileFullPath) use ($aExcludedModulesList) { $sModuleFullPath = dirname($sDictFileFullPath); $sModuleDirectory = basename($sModuleFullPath); - echo $sModuleDirectory; return !in_array($sModuleDirectory, $aExcludedModulesList); } );