N°7143 Move datamodels/2.x dict files to dictionaries subdir

New phpunit method to ensure it won't happen again
This commit is contained in:
Pierre Goiffon
2024-01-15 15:00:08 +01:00
parent 9eeb4b8751
commit 8ef04bedf2
36 changed files with 138 additions and 273 deletions

View File

@@ -18,7 +18,6 @@ namespace Combodo\iTop\Test\UnitTest\Integration;
use Combodo\iTop\Test\UnitTest\ItopTestCase;
/**
* Wrapper to load dictionnary files without altering the main dictionnary
* Eval will be called within the current namespace (this is done by adding a "namespace" statement)
@@ -109,7 +108,7 @@ class DictionariesConsistencyTest extends ItopTestCase
{
$this->setUp();
$sAppRoot = $this->GetAppRoot();
$sAppRoot = static::GetAppRoot();
$aDictFiles = array_merge(
glob($sAppRoot.'datamodels/2.x/*/*.dict*.php'), // legacy form in modules
@@ -189,4 +188,13 @@ class DictionariesConsistencyTest extends ItopTestCase
}
$this->assertTrue(true);
}
public function testNoDictFileInDatamodelsModuleRootDirectory():void {
$sAppRoot = static::GetAppRoot();
$aDictFilesInDatamodelsModuleRootDir = glob($sAppRoot.'datamodels/2.x/*/*.dict*.php');
$this->assertNotFalse($aDictFilesInDatamodelsModuleRootDir, 'Searching for files returned an error');
$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));
}
}