N°9678 - Datamodel not added after extension management setup (#936)

* N°9678 - Datamodel not added after extension management setup

* N°9678 - fix selecting extensions from extensions folder in extension mgt view

* cleanup: remove cached stuff in runtimeenv

* N°9678 - Refactor iTopExtensionsMap instantiation to use GetExtensionsMap method

* N°9678 - Refactor data model compilation and improve directory scanning logic

* N°9678 - Handle MySQLException in ModuleInstallationRepository and remove unnecessary error logging in WizStepModulesChoice

---------

Co-authored-by: Eric Espie <eric.espie@combodo.com>
This commit is contained in:
odain-cbd
2026-06-17 10:22:05 +02:00
committed by GitHub
parent 0240d12007
commit 207ac373d0
30 changed files with 620 additions and 188 deletions

View File

@@ -19,7 +19,7 @@ class ExtensionsMapTest extends ItopTestCase
public function testGetAllExtensionsWithPreviouslyInstalledDoesNotCrash()
{
$oExtensionsMap = new iTopExtensionsMap();
$oExtensionsMap = iTopExtensionsMap::GetExtensionsMap();
$aExtensions = $oExtensionsMap->GetAllExtensionsWithPreviouslyInstalled();
$this->assertGreaterThan(0, count($aExtensions));
}
@@ -84,7 +84,7 @@ class ExtensionsMapTest extends ItopTestCase
private function GiveExtensionMapWithAllTypeOfExtensions(): iTopExtensionsMap
{
$oExtensionsMap = new iTopExtensionsMap();
$oExtensionsMap = iTopExtensionsMap::GetExtensionsMap();
$this->SetNonPublicProperty($oExtensionsMap, 'aInstalledExtensions', []);
$this->SetNonPublicProperty($oExtensionsMap, 'aExtensions', []);
@@ -153,9 +153,7 @@ class ExtensionsMapTest extends ItopTestCase
public function testiTopExtensionsMapInit()
{
$oiTopExtensionsMap = new iTopExtensionsMap(sAppRootForTests:__DIR__."/ressources");
//file_put_contents(__DIR__.'/ressources/all_extensions_from_datamodels.json', json_encode($this->SerializeExtensionMap($oiTopExtensionsMap), JSON_PRETTY_PRINT));
$oiTopExtensionsMap = iTopExtensionsMap::GetExtensionsMap(sAppRootForTests: __DIR__."/ressources/");
$sExpected = file_get_contents(__DIR__.'/ressources/all_extensions_from_datamodels.json');
$sExpected = str_replace('"sVersion": "ITOP_VERSION"', '"sVersion": "'.ITOP_VERSION.'"', $sExpected);
@@ -166,6 +164,19 @@ class ExtensionsMapTest extends ItopTestCase
$this->assertEquals($sExpected, $actual);
}
public function testGetScannedModulesRootDirs()
{
$sAppRootForTest = __DIR__."/resources2/";
$oiTopExtensionsMap = iTopExtensionsMap::GetExtensionsMap(sAppRootForTests: $sAppRootForTest);
$aExpectedDirs = [
"{$sAppRootForTest}datamodels/2.x",
"{$sAppRootForTest}extensions",
"{$sAppRootForTest}data/production-modules",
];
self::assertEquals($aExpectedDirs, $oiTopExtensionsMap->GetScannedModulesRootDirs());
}
public function SerializeExtensionMap(iTopExtensionsMap $oiTopExtensionsMap): array
{
$aRes = [];