From b5af30a93fae44608adba1a246dbadb8f010c421 Mon Sep 17 00:00:00 2001 From: odain Date: Fri, 12 Apr 2024 10:19:46 +0200 Subject: [PATCH 1/6] =?UTF-8?q?N=C2=B07407=20-=20refactor=20unattended=20t?= =?UTF-8?q?ests=20to=20make=20work=20anywhere?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../InstallationFileService.php | 24 +- .../InstallationFileServiceTest.php | 236 +++++++++++++++--- .../resources/AnalyzeInstallation.json | 1 + .../{ => resources}/installation.xml | 0 4 files changed, 222 insertions(+), 39 deletions(-) create mode 100644 tests/php-unit-tests/unitary-tests/setup/unattended-install/resources/AnalyzeInstallation.json rename tests/php-unit-tests/unitary-tests/setup/unattended-install/{ => resources}/installation.xml (100%) diff --git a/setup/unattended-install/InstallationFileService.php b/setup/unattended-install/InstallationFileService.php index 103080e59..301fd8ba2 100644 --- a/setup/unattended-install/InstallationFileService.php +++ b/setup/unattended-install/InstallationFileService.php @@ -14,6 +14,9 @@ if (version_compare(ITOP_DESIGN_LATEST_VERSION, '2.7', '<=')) { } class InstallationFileService { + /** @var \RunTimeEnvironment $oProductionEnv */ + private $oProductionEnv; + private $sTargetEnvironment; private $sInstallationPath; private $aSelectedModules; @@ -37,6 +40,21 @@ class InstallationFileService { $this->bInstallationOptionalChoicesChecked = $bInstallationOptionalChoicesChecked; } + public function GetProductionEnv(): RunTimeEnvironment { + if (is_null($this->oProductionEnv)){ + $this->oProductionEnv = new RunTimeEnvironment(); + } + return $this->oProductionEnv; + } + + public function SetProductionEnv(RunTimeEnvironment $oProductionEnv): void { + $this->oProductionEnv = $oProductionEnv; + } + + public function GetAutoSelectModules(): array { + return $this->aAutoSelectModules; + } + public function GetSelectedModules(): array { return $this->aSelectedModules; } @@ -206,8 +224,7 @@ class InstallationFileService { public function ProcessDefaultModules() : void { $sProductionModuleDir = APPROOT.'data/' . $this->sTargetEnvironment . '-modules/'; - $oProductionEnv = new RunTimeEnvironment(); - $aAvailableModules = $oProductionEnv->AnalyzeInstallation(MetaModel::GetConfig(), $this->GetExtraDirs(), false, null); + $aAvailableModules = $this->GetProductionEnv()->AnalyzeInstallation(MetaModel::GetConfig(), $this->GetExtraDirs(), false, null); $this->aAutoSelectModules = []; foreach ($aAvailableModules as $sModuleId => $aModule) { @@ -221,7 +238,6 @@ class InstallationFileService { $this->aSelectedModules[$sModuleId] = true; continue; } - $bIsExtra = (array_key_exists('root_dir', $aModule) && (strpos($aModule['root_dir'], $sProductionModuleDir) !== false)); // Some modules (root, datamodel) have no 'root_dir' if ($bIsExtra) { @@ -233,7 +249,7 @@ class InstallationFileService { } public function ProcessAutoSelectModules() : void { - foreach($this->aAutoSelectModules as $sModuleId => $aModule) + foreach($this->GetAutoSelectModules() as $sModuleId => $aModule) { try { $bSelected = false; diff --git a/tests/php-unit-tests/unitary-tests/setup/unattended-install/InstallationFileServiceTest.php b/tests/php-unit-tests/unitary-tests/setup/unattended-install/InstallationFileServiceTest.php index 3fc8b8d52..272e913e2 100644 --- a/tests/php-unit-tests/unitary-tests/setup/unattended-install/InstallationFileServiceTest.php +++ b/tests/php-unit-tests/unitary-tests/setup/unattended-install/InstallationFileServiceTest.php @@ -2,16 +2,17 @@ namespace Combodo\iTop\Test\UnitTest\Setup\UnattendedInstall; +use Combodo\iTop\Test\UnitTest\ItopDataTestCase; +use Combodo\iTop\Test\UnitTest\ItopTestCase; use PHPUnit\Framework\TestCase; /** * @group itop-clone-only */ -class InstallationFileServiceTest extends TestCase { +class InstallationFileServiceTest extends ItopTestCase { protected function setUp(): void { parent::setUp(); require_once(dirname(__FILE__, 6) . '/setup/unattended-install/InstallationFileService.php'); - $this->sFolderToCleanup = null; \ModuleDiscovery::ResetCache(); } @@ -23,10 +24,112 @@ class InstallationFileServiceTest extends TestCase { } private function GetInstallationPath() : string { - return realpath(__DIR__ . '/installation.xml'); + return realpath(__DIR__ . '/resources/installation.xml'); } - public function GetDefaultModulesProvider() { + private function GetModuleData($sCategory, bool $bIsVisible, bool $bIsAutoSelect, bool $bProductionModulesInRootDir=false) : array { + $sRootDir = $bProductionModulesInRootDir ? APPROOT.'data/production-modules/' : ''; + + $aModuleData = [ + 'category' => $sCategory, + 'visible' => $bIsVisible, + 'root_dir' => $sRootDir, + ]; + + if ($bIsAutoSelect){ + $aModuleData['auto_select'] = true; + } + + return $aModuleData; + } + + public function ProcessDefaultModulesProvider() { + parent::setUp(); + return [ + 'root module' => [ + 'aAllFoundModules' => [ + '_Root_' => $this->GetModuleData('authentication', false, false, true), + ], + 'aExpectedSelectedModules' => [], + 'aExpectedAutoSelectModules' => [], + ], + 'auto-select root module' => [ + 'aAllFoundModules' => [ + '_Root_' => $this->GetModuleData('authentication', false, true, true), + ], + 'aExpectedSelectedModules' => [], + 'aExpectedAutoSelectModules' => [], + ], + 'autoselect module only' => [ + 'aAllFoundModules' => [ + 'autoselect-only' => $this->GetModuleData('mycategory', true, true), + ], + 'aExpectedSelectedModules' => [], + 'aExpectedAutoSelectModules' => ['autoselect-only'], + ], + 'autoselect/invisible module' => [ + 'aAllFoundModules' => [ + 'autoselect-only' => $this->GetModuleData('mycategory', false, true), + ], + 'aExpectedSelectedModules' => [], + 'aExpectedAutoSelectModules' => ['autoselect-only'], + ], + 'autoselect/invisible/in-root-dir module' => [ + 'aAllFoundModules' => [ + 'autoselect-only' => $this->GetModuleData('mycategory', false, true , true), + ], + 'aExpectedSelectedModules' => [], + 'aExpectedAutoSelectModules' => ['autoselect-only'], + ], + 'visible/authent module' => [ + 'aAllFoundModules' => [ + 'authent-module' => $this->GetModuleData('authentication', true, false , false), + ], + 'aExpectedSelectedModules' => ['authent-module'], + 'aExpectedAutoSelectModules' => [], + ], + 'invisible module' => [ + 'aAllFoundModules' => [ + 'visible-module' => $this->GetModuleData('mycategory', false, false , false), + ], + 'aExpectedSelectedModules' => ['visible-module'], + 'aExpectedAutoSelectModules' => [], + ], + 'in-root-dir module' => [ + 'aAllFoundModules' => [ + 'in-root-dir-module' => $this->GetModuleData('mycategory', true, false , true), + ], + 'aExpectedSelectedModules' => ['in-root-dir-module'], + 'aExpectedAutoSelectModules' => [], + ], + ]; + } + /** + * @dataProvider ProcessDefaultModulesProvider + */ + public function testProcessDefaultModules(array $aAllFoundModules, array $aExpectedSelectedModules, array $aExpectedAutoSelectModules) { + $oInstallationFileService = new \InstallationFileService('', 'production', [], true); + + $oProductionEnv = $this->createMock(\RunTimeEnvironment::class); + $oProductionEnv->expects($this->once()) + ->method('AnalyzeInstallation') + ->willReturn($aAllFoundModules); + + $oInstallationFileService->SetProductionEnv($oProductionEnv); + $oInstallationFileService->ProcessDefaultModules(); + + sort($aExpectedSelectedModules); + $aModules = array_keys($oInstallationFileService->GetSelectedModules()); + sort($aModules); + + $this->assertEquals($aExpectedSelectedModules, $aModules); + + $aAutoSelectModules = array_keys($oInstallationFileService->GetAutoSelectModules()); + sort($aAutoSelectModules); + $this->assertEquals($aExpectedAutoSelectModules, $aAutoSelectModules); + } + + public function ProcessInstallationChoicesProvider() { return [ 'all checked' => [ true ], 'only defaut + mandatory' => [ false ], @@ -34,12 +137,16 @@ class InstallationFileServiceTest extends TestCase { } /** - * @dataProvider GetDefaultModulesProvider + * @dataProvider ProcessInstallationChoicesProvider */ - public function testProcessInstallationChoices($bInstallationOptionalChoicesChecked=false) { + public function testProcessInstallationChoices($bInstallationOptionalChoicesChecked) { $sPath = $this->GetInstallationPath(); - $this->assertTrue(is_file($sPath)); $oInstallationFileService = new \InstallationFileService($sPath, 'production', [], $bInstallationOptionalChoicesChecked); + $oProductionEnv = $this->createMock(\RunTimeEnvironment::class); + $oProductionEnv->expects($this->never()) + ->method('AnalyzeInstallation'); + $oInstallationFileService->SetProductionEnv($oProductionEnv); + $oInstallationFileService->ProcessInstallationChoices(); $aExpectedModules = [ "itop-config-mgmt", @@ -90,12 +197,92 @@ class InstallationFileServiceTest extends TestCase { $this->assertEquals($aExpectedUnselectedModules, $aUnselectedModules); } + /** + * @dataProvider ItilExtensionProvider + */ + public function testProcessInstallationChoicesWithItilChoices(array $aSelectedExtensions, bool $bKnownMgtSelected) { + $sPath = $this->GetInstallationPath(); + $oInstallationFileService = new \InstallationFileService($sPath, 'production', $aSelectedExtensions, false); + $oProductionEnv = $this->createMock(\RunTimeEnvironment::class); + $oProductionEnv->expects($this->never()) + ->method('AnalyzeInstallation'); + $oInstallationFileService->SetProductionEnv($oProductionEnv); + + $oInstallationFileService->ProcessInstallationChoices(); + + $aExpectedInstallationModules = [ + "itop-config-mgmt", + "itop-attachments", + "itop-profiles-itil", + "itop-welcome-itil", + "itop-tickets", + "itop-files-information", + "combodo-db-tools", + "itop-core-update", + "itop-hub-connector", + "itop-oauth-client", + "itop-datacenter-mgmt", + "itop-endusers-devices", + "itop-storage-mgmt", + "itop-virtualization-mgmt", + "itop-service-mgmt", + "itop-request-mgmt-itil", + "itop-incident-mgmt-itil", + "itop-portal", + "itop-portal-base", + "itop-change-mgmt-itil", + ]; + if ($bKnownMgtSelected){ + $aExpectedInstallationModules []= "itop-knownerror-mgmt"; + } + + sort($aExpectedInstallationModules); + $aModules = array_keys($oInstallationFileService->GetSelectedModules()); + sort($aModules); + + $this->assertEquals($aExpectedInstallationModules, $aModules); + + $aExpectedUnselectedModules = [ + 0 => 'itop-change-mgmt', + 1 => 'itop-problem-mgmt', + 2 => 'itop-request-mgmt', + 3 => 'itop-service-mgmt-provider', + ]; + if (!$bKnownMgtSelected){ + $aExpectedUnselectedModules[]='itop-knownerror-mgmt'; + } + $aUnselectedModules = array_keys($oInstallationFileService->GetUnSelectedModules()); + sort($aExpectedUnselectedModules); + sort($aUnselectedModules); + $this->assertEquals($aExpectedUnselectedModules, $aUnselectedModules); + } + + public function GetDefaultModulesProvider() { + return [ + 'check all possible modules' => [true], + 'only minimum defaul/mandatory from installation.xml' => [false], + ]; + } + + private function GetMockListOfFoundModules() : array { + $sJsonContent = file_get_contents(realpath(__DIR__ . '/resources/AnalyzeInstallation.json')); + $sJsonContent = str_replace('ROOTDIR_TOREPLACE', APPROOT, $sJsonContent); + return json_decode($sJsonContent, true); + } + /** * @dataProvider GetDefaultModulesProvider */ public function testGetAllSelectedModules($bInstallationOptionalChoicesChecked=false) { $sPath = $this->GetInstallationPath(); $oInstallationFileService = new \InstallationFileService($sPath, 'production', [], $bInstallationOptionalChoicesChecked); + + $oProductionEnv = $this->createMock(\RunTimeEnvironment::class); + $oProductionEnv->expects($this->once()) + ->method('AnalyzeInstallation') + ->willReturn($this->GetMockListOfFoundModules()); + $oInstallationFileService->SetProductionEnv($oProductionEnv); + $oInstallationFileService->Init(); $aSelectedModules = $oInstallationFileService->GetSelectedModules(); @@ -202,6 +389,13 @@ class InstallationFileServiceTest extends TestCase { public function testGetAllSelectedModules_withItilExtensions(array $aSelectedExtensions, bool $bKnownMgtSelected) { $sPath = $this->GetInstallationPath(); $oInstallationFileService = new \InstallationFileService($sPath, 'production', $aSelectedExtensions); + + $oProductionEnv = $this->createMock(\RunTimeEnvironment::class); + $oProductionEnv->expects($this->once()) + ->method('AnalyzeInstallation') + ->willReturn($this->GetMockListOfFoundModules()); + $oInstallationFileService->SetProductionEnv($oProductionEnv); + $oInstallationFileService->Init(); $aSelectedModules = $oInstallationFileService->GetSelectedModules(); @@ -271,34 +465,6 @@ class InstallationFileServiceTest extends TestCase { } - public function ProductionModulesProvider() { - return [ - 'module autoload as located in production-modules' => [ true ], - 'module not loaded' => [ false ], - ]; - } - - /** - * @dataProvider ProductionModulesProvider - */ - public function testGetAllSelectedModules_ProductionModules(bool $bModuleInProductionModulesFolder) { - $sModuleId = "itop-problem-mgmt"; - if ($bModuleInProductionModulesFolder){ - if (! is_dir(APPROOT."data/production-modules")){ - @mkdir(APPROOT."data/production-modules"); - } - - $this->RecurseMoveDir(APPROOT . "datamodels/2.x/$sModuleId", APPROOT."data/production-modules/$sModuleId"); - } - - $sPath = $this->GetInstallationPath(); - $oInstallationFileService = new \InstallationFileService($sPath, 'production', [], false); - $oInstallationFileService->Init(); - - $aSelectedModules = $oInstallationFileService->GetSelectedModules(); - $this->assertEquals($bModuleInProductionModulesFolder, array_key_exists($sModuleId, $aSelectedModules)); - } - private function RecurseMoveDir($sFromDir, $sToDir) { if (! is_dir($sFromDir)){ return; diff --git a/tests/php-unit-tests/unitary-tests/setup/unattended-install/resources/AnalyzeInstallation.json b/tests/php-unit-tests/unitary-tests/setup/unattended-install/resources/AnalyzeInstallation.json new file mode 100644 index 000000000..7000b45d8 --- /dev/null +++ b/tests/php-unit-tests/unitary-tests/setup/unattended-install/resources/AnalyzeInstallation.json @@ -0,0 +1 @@ +{"_Root_":{"version_db":"","name_db":"","version_code":"2.7.0-dev-svn","name_code":"iTop"},"authent-cas":{"label":"CAS SSO","category":"authentication","dependencies":[],"mandatory":true,"visible":true,"datamodel":["model.authent-cas.php","vendor\/autoload.php","src\/CASLoginExtension.php"],"webservice":[],"data.struct":[],"data.sample":[],"doc.manual_setup":"","doc.more_information":"","settings":{"cas_debug":false,"cas_host":"","cas_port":"","cas_context":"","cas_version":"","service_base_url":""},"itop_version":"1.0.2","root_dir":"ROOTDIR_TOREPLACEdatamodels\/2.x\/authent-cas","module_file":"ROOTDIR_TOREPLACEdatamodels\/2.x\/authent-cas\/module.authent-cas.php","dictionary":["2.x\/authent-cas\/de.dict.authent-cas.php","2.x\/authent-cas\/cs.dict.authent-cas.php","2.x\/authent-cas\/nl.dict.authent-cas.php","2.x\/authent-cas\/da.dict.authent-cas.php","2.x\/authent-cas\/tr.dict.authent-cas.php","2.x\/authent-cas\/ru.dict.authent-cas.php","2.x\/authent-cas\/ja.dict.authent-cas.php","2.x\/authent-cas\/es_cr.dict.authent-cas.php","2.x\/authent-cas\/it.dict.authent-cas.php","2.x\/authent-cas\/pt_br.dict.authent-cas.php","2.x\/authent-cas\/sk.dict.authent-cas.php","2.x\/authent-cas\/hu.dict.authent-cas.php","2.x\/authent-cas\/zh_cn.dict.authent-cas.php","2.x\/authent-cas\/en.dict.authent-cas.php","2.x\/authent-cas\/fr.dict.authent-cas.php"],"version_db":"","version_code":"2.7.10","install":{"flag":2,"message":"the module is part of the application"}},"authent-external":{"label":"External user authentication","category":"authentication","dependencies":[],"mandatory":false,"visible":true,"datamodel":["model.authent-external.php"],"data.struct":[],"data.sample":[],"doc.manual_setup":"","doc.more_information":"","settings":[],"itop_version":"1.0.2","root_dir":"ROOTDIR_TOREPLACEdatamodels\/2.x\/authent-external","module_file":"ROOTDIR_TOREPLACEdatamodels\/2.x\/authent-external\/module.authent-external.php","dictionary":["2.x\/authent-external\/fr.dict.authent-external.php","2.x\/authent-external\/de.dict.authent-external.php","2.x\/authent-external\/zh_cn.dict.authent-external.php","2.x\/authent-external\/tr.dict.authent-external.php","2.x\/authent-external\/pt_br.dict.authent-external.php","2.x\/authent-external\/da.dict.authent-external.php","2.x\/authent-external\/ru.dict.authent-external.php","2.x\/authent-external\/cs.dict.authent-external.php","2.x\/authent-external\/it.dict.authent-external.php","2.x\/authent-external\/en.dict.authent-external.php","2.x\/authent-external\/hu.dict.authent-external.php","2.x\/authent-external\/sk.dict.authent-external.php","2.x\/authent-external\/ja.dict.authent-external.php","2.x\/authent-external\/nl.dict.authent-external.php","2.x\/authent-external\/es_cr.dict.authent-external.php"],"version_db":"","version_code":"2.7.10","install":{"flag":1,"message":""}},"authent-ldap":{"label":"User authentication based on LDAP","category":"authentication","dependencies":[],"mandatory":false,"visible":true,"datamodel":["model.authent-ldap.php"],"data.struct":[],"data.sample":[],"doc.manual_setup":"","doc.more_information":"","settings":{"host":"localhost","port":389,"default_user":"","default_pwd":"","base_dn":"dc=yourcompany,dc=com","user_query":"(&(uid=%1$s)(inetuserstatus=ACTIVE))","options":{"17":3,"8":0},"start_tls":false,"debug":false},"itop_version":"1.0.2","root_dir":"ROOTDIR_TOREPLACEdatamodels\/2.x\/authent-ldap","module_file":"ROOTDIR_TOREPLACEdatamodels\/2.x\/authent-ldap\/module.authent-ldap.php","dictionary":["2.x\/authent-ldap\/en.dict.authent-ldap.php","2.x\/authent-ldap\/ru.dict.authent-ldap.php","2.x\/authent-ldap\/cs.dict.authent-ldap.php","2.x\/authent-ldap\/es_cr.dict.authent-ldap.php","2.x\/authent-ldap\/zh_cn.dict.authent-ldap.php","2.x\/authent-ldap\/pt_br.dict.authent-ldap.php","2.x\/authent-ldap\/it.dict.authent-ldap.php","2.x\/authent-ldap\/tr.dict.authent-ldap.php","2.x\/authent-ldap\/fr.dict.authent-ldap.php","2.x\/authent-ldap\/de.dict.authent-ldap.php","2.x\/authent-ldap\/da.dict.authent-ldap.php","2.x\/authent-ldap\/nl.dict.authent-ldap.php","2.x\/authent-ldap\/hu.dict.authent-ldap.php","2.x\/authent-ldap\/sk.dict.authent-ldap.php","2.x\/authent-ldap\/ja.dict.authent-ldap.php"],"version_db":"","version_code":"2.7.10","install":{"flag":1,"message":""}},"authent-local":{"label":"User authentication based on the local DB","category":"authentication","dependencies":[],"mandatory":true,"visible":true,"datamodel":["model.authent-local.php"],"data.struct":[],"data.sample":[],"doc.manual_setup":"","doc.more_information":"","settings":[],"itop_version":"1.0.2","root_dir":"ROOTDIR_TOREPLACEdatamodels\/2.x\/authent-local","module_file":"ROOTDIR_TOREPLACEdatamodels\/2.x\/authent-local\/module.authent-local.php","dictionary":["2.x\/authent-local\/hu.dict.authent-local.php","2.x\/authent-local\/de.dict.authent-local.php","2.x\/authent-local\/ja.dict.authent-local.php","2.x\/authent-local\/fr.dict.authent-local.php","2.x\/authent-local\/es_cr.dict.authent-local.php","2.x\/authent-local\/it.dict.authent-local.php","2.x\/authent-local\/tr.dict.authent-local.php","2.x\/authent-local\/da.dict.authent-local.php","2.x\/authent-local\/sk.dict.authent-local.php","2.x\/authent-local\/ru.dict.authent-local.php","2.x\/authent-local\/nl.dict.authent-local.php","2.x\/authent-local\/zh_cn.dict.authent-local.php","2.x\/authent-local\/cs.dict.authent-local.php","2.x\/authent-local\/en.dict.authent-local.php","2.x\/authent-local\/pt_br.dict.authent-local.php"],"version_db":"","version_code":"2.7.10","install":{"flag":2,"message":"the module is part of the application"}},"combodo-db-tools":{"label":"Database maintenance tools","category":"business","dependencies":[],"mandatory":false,"visible":true,"datamodel":["model.combodo-db-tools.php","src\/Service\/DBToolsUtils.php","src\/Service\/DBAnalyzerUtils.php"],"webservice":[],"data.struct":[],"data.sample":[],"doc.manual_setup":"","doc.more_information":"","settings":[],"itop_version":"1.0.2","root_dir":"ROOTDIR_TOREPLACEdatamodels\/2.x\/combodo-db-tools","module_file":"ROOTDIR_TOREPLACEdatamodels\/2.x\/combodo-db-tools\/module.combodo-db-tools.php","dictionary":["2.x\/combodo-db-tools\/en.dict.combodo-db-tools.php","2.x\/combodo-db-tools\/pt_br.dict.combodo-db-tools.php","2.x\/combodo-db-tools\/zh_cn.dict.combodo-db-tools.php","2.x\/combodo-db-tools\/nl.dict.combodo-db-tools.php","2.x\/combodo-db-tools\/ru.dict.combodo-db-tools.php","2.x\/combodo-db-tools\/es_cr.dict.combodo-db-tools.php","2.x\/combodo-db-tools\/tr.dict.combodo-db-tools.php","2.x\/combodo-db-tools\/da.dict.combodo-db-tools.php","2.x\/combodo-db-tools\/ja.dict.combodo-db-tools.php","2.x\/combodo-db-tools\/de.dict.combodo-db-tools.php","2.x\/combodo-db-tools\/hu.dict.combodo-db-tools.php","2.x\/combodo-db-tools\/fr.dict.combodo-db-tools.php","2.x\/combodo-db-tools\/it.dict.combodo-db-tools.php","2.x\/combodo-db-tools\/sk.dict.combodo-db-tools.php","2.x\/combodo-db-tools\/cs.dict.combodo-db-tools.php"],"version_db":"","version_code":"2.7.10","install":{"flag":1,"message":""}},"combodo-monitoring":{"label":"Combodo Monitoring","category":"monitoring","dependencies":[],"mandatory":false,"visible":true,"datamodel":["vendor\/autoload.php"],"webservice":[],"data.struct":[],"data.sample":[],"doc.manual_setup":"","doc.more_information":"","settings":[],"itop_version":"1.0.2","root_dir":"\/var\/www\/html\/iTop\/extensions\/combodo-monitoring","module_file":"\/var\/www\/html\/iTop\/extensions\/combodo-monitoring\/module.combodo-monitoring.php","version_db":"","version_code":"1.0.7","install":{"flag":1,"message":""}},"itop-attachments":{"label":"Tickets Attachments","category":"business","dependencies":[],"mandatory":false,"visible":true,"installer":"AttachmentInstaller","datamodel":["model.itop-attachments.php","main.itop-attachments.php","renderers.itop-attachments.php"],"webservice":[],"dictionary":["2.x\/itop-attachments\/cs.dict.itop-attachments.php","2.x\/itop-attachments\/ja.dict.itop-attachments.php","2.x\/itop-attachments\/es_cr.dict.itop-attachments.php","2.x\/itop-attachments\/ru.dict.itop-attachments.php","2.x\/itop-attachments\/it.dict.itop-attachments.php","2.x\/itop-attachments\/zh_cn.dict.itop-attachments.php","2.x\/itop-attachments\/hu.dict.itop-attachments.php","2.x\/itop-attachments\/da.dict.itop-attachments.php","2.x\/itop-attachments\/en.dict.itop-attachments.php","2.x\/itop-attachments\/sk.dict.itop-attachments.php","2.x\/itop-attachments\/pt_br.dict.itop-attachments.php","2.x\/itop-attachments\/fr.dict.itop-attachments.php","2.x\/itop-attachments\/de.dict.itop-attachments.php","2.x\/itop-attachments\/tr.dict.itop-attachments.php","2.x\/itop-attachments\/nl.dict.itop-attachments.php"],"data.struct":[],"data.sample":[],"doc.manual_setup":"","doc.more_information":"","settings":{"allowed_classes":["Ticket"],"position":"relations","preview_max_width":290},"itop_version":"1.0.2","root_dir":"ROOTDIR_TOREPLACEdatamodels\/2.x\/itop-attachments","module_file":"ROOTDIR_TOREPLACEdatamodels\/2.x\/itop-attachments\/module.itop-attachments.php","version_db":"","version_code":"2.7.10","install":{"flag":1,"message":""}},"itop-backup":{"label":"Backup utilities","category":"Application management","dependencies":[],"mandatory":true,"visible":false,"datamodel":["main.itop-backup.php","model.itop-backup.php"],"webservice":[],"dictionary":["en.dict.itop-backup.php","fr.dict.itop-backup.php","2.x\/itop-backup\/cs.dict.itop-backup.php","2.x\/itop-backup\/es_cr.dict.itop-backup.php","2.x\/itop-backup\/fr.dict.itop-backup.php","2.x\/itop-backup\/de.dict.itop-backup.php","2.x\/itop-backup\/ja.dict.itop-backup.php","2.x\/itop-backup\/en.dict.itop-backup.php","2.x\/itop-backup\/hu.dict.itop-backup.php","2.x\/itop-backup\/nl.dict.itop-backup.php","2.x\/itop-backup\/it.dict.itop-backup.php","2.x\/itop-backup\/sk.dict.itop-backup.php","2.x\/itop-backup\/ru.dict.itop-backup.php","2.x\/itop-backup\/tr.dict.itop-backup.php","2.x\/itop-backup\/pt_br.dict.itop-backup.php","2.x\/itop-backup\/da.dict.itop-backup.php","2.x\/itop-backup\/zh_cn.dict.itop-backup.php"],"data.struct":[],"data.sample":[],"doc.manual_setup":"","doc.more_information":"","settings":{"mysql_bindir":"","week_days":"monday, tuesday, wednesday, thursday, friday","time":"23:30","retention_count":5,"enabled":true,"itop_backup_incident":""},"itop_version":"1.0.2","root_dir":"ROOTDIR_TOREPLACEdatamodels\/2.x\/itop-backup","module_file":"ROOTDIR_TOREPLACEdatamodels\/2.x\/itop-backup\/module.itop-backup.php","version_db":"","version_code":"2.7.10","install":{"flag":2,"message":"the module is part of the application"}},"itop-config-mgmt":{"label":"Configuration Management (CMDB)","category":"business","dependencies":[],"mandatory":true,"visible":true,"installer":"ConfigMgmtInstaller","datamodel":["model.itop-config-mgmt.php","main.itop-config-mgmt.php"],"data.struct":[],"data.sample":["data.sample.organizations.xml","data.sample.brand.xml","data.sample.model.xml","data.sample.osfamily.xml","data.sample.osversion.xml","data.sample.networkdevicetype.xml","data.sample.contacttype.xml","data.sample.locations.xml","data.sample.persons.xml","data.sample.teams.xml","data.sample.contactteam.xml","data.sample.servers.xml","data.sample.nw-devices.xml","data.sample.software.xml","data.sample.dbserver.xml","data.sample.dbschema.xml","data.sample.webserver.xml","data.sample.webapp.xml","data.sample.applications.xml","data.sample.applicationsolutionci.xml"],"doc.manual_setup":"","doc.more_information":"","settings":[],"itop_version":"1.0.2","root_dir":"ROOTDIR_TOREPLACEdatamodels\/2.x\/itop-config-mgmt","module_file":"ROOTDIR_TOREPLACEdatamodels\/2.x\/itop-config-mgmt\/module.itop-config-mgmt.php","dictionary":["2.x\/itop-config-mgmt\/ru.dict.itop-config-mgmt.php","2.x\/itop-config-mgmt\/tr.dict.itop-config-mgmt.php","2.x\/itop-config-mgmt\/it.dict.itop-config-mgmt.php","2.x\/itop-config-mgmt\/de.dict.itop-config-mgmt.php","2.x\/itop-config-mgmt\/fr.dict.itop-config-mgmt.php","2.x\/itop-config-mgmt\/hu.dict.itop-config-mgmt.php","2.x\/itop-config-mgmt\/nl.dict.itop-config-mgmt.php","2.x\/itop-config-mgmt\/en.dict.itop-config-mgmt.php","2.x\/itop-config-mgmt\/cs.dict.itop-config-mgmt.php","2.x\/itop-config-mgmt\/ja.dict.itop-config-mgmt.php","2.x\/itop-config-mgmt\/sk.dict.itop-config-mgmt.php","2.x\/itop-config-mgmt\/zh_cn.dict.itop-config-mgmt.php","2.x\/itop-config-mgmt\/da.dict.itop-config-mgmt.php","2.x\/itop-config-mgmt\/pt_br.dict.itop-config-mgmt.php","2.x\/itop-config-mgmt\/es_cr.dict.itop-config-mgmt.php"],"version_db":"","version_code":"2.7.10","install":{"flag":2,"message":"the module is part of the application"}},"itop-config":{"label":"Configuration editor","category":"Application management","dependencies":[],"mandatory":true,"visible":false,"datamodel":["model.itop-config.php","src\/Validator\/ConfigNodesVisitor.php","src\/Validator\/iTopConfigAstValidator.php","src\/Validator\/iTopConfigSyntaxValidator.php"],"webservice":[],"dictionary":["en.dict.itop-config.php","fr.dict.itop-config.php","2.x\/itop-config\/ru.dict.itop-config.php","2.x\/itop-config\/en.dict.itop-config.php","2.x\/itop-config\/sk.dict.itop-config.php","2.x\/itop-config\/cs.dict.itop-config.php","2.x\/itop-config\/de.dict.itop-config.php","2.x\/itop-config\/zh_cn.dict.itop-config.php","2.x\/itop-config\/nl.dict.itop-config.php","2.x\/itop-config\/es_cr.dict.itop-config.php","2.x\/itop-config\/da.dict.itop-config.php","2.x\/itop-config\/ja.dict.itop-config.php","2.x\/itop-config\/pt_br.dict.itop-config.php","2.x\/itop-config\/tr.dict.itop-config.php","2.x\/itop-config\/hu.dict.itop-config.php","2.x\/itop-config\/it.dict.itop-config.php","2.x\/itop-config\/fr.dict.itop-config.php"],"data.struct":[],"data.sample":[],"doc.manual_setup":"","doc.more_information":"","settings":[],"itop_version":"1.0.2","root_dir":"ROOTDIR_TOREPLACEdatamodels\/2.x\/itop-config","module_file":"ROOTDIR_TOREPLACEdatamodels\/2.x\/itop-config\/module.itop-config.php","version_db":"","version_code":"2.7.10","install":{"flag":2,"message":"the module is part of the application"}},"itop-datacenter-mgmt":{"label":"Datacenter Management","category":"business","dependencies":["itop-config-mgmt\/2.2.0"],"mandatory":false,"visible":true,"datamodel":["model.itop-datacenter-mgmt.php"],"webservice":[],"data.struct":[],"data.sample":["data.sample.racks.xml"],"doc.manual_setup":"","doc.more_information":"","settings":[],"itop_version":"1.0.2","root_dir":"ROOTDIR_TOREPLACEdatamodels\/2.x\/itop-datacenter-mgmt","module_file":"ROOTDIR_TOREPLACEdatamodels\/2.x\/itop-datacenter-mgmt\/module.itop-datacenter-mgmt.php","dictionary":["2.x\/itop-datacenter-mgmt\/tr.dict.itop-datacenter-mgmt.php","2.x\/itop-datacenter-mgmt\/ja.dict.itop-datacenter-mgmt.php","2.x\/itop-datacenter-mgmt\/sk.dict.itop-datacenter-mgmt.php","2.x\/itop-datacenter-mgmt\/da.dict.itop-datacenter-mgmt.php","2.x\/itop-datacenter-mgmt\/es_cr.dict.itop-datacenter-mgmt.php","2.x\/itop-datacenter-mgmt\/ru.dict.itop-datacenter-mgmt.php","2.x\/itop-datacenter-mgmt\/en.dict.itop-datacenter-mgmt.php","2.x\/itop-datacenter-mgmt\/it.dict.itop-datacenter-mgmt.php","2.x\/itop-datacenter-mgmt\/zh_cn.dict.itop-datacenter-mgmt.php","2.x\/itop-datacenter-mgmt\/de.dict.itop-datacenter-mgmt.php","2.x\/itop-datacenter-mgmt\/hu.dict.itop-datacenter-mgmt.php","2.x\/itop-datacenter-mgmt\/cs.dict.itop-datacenter-mgmt.php","2.x\/itop-datacenter-mgmt\/fr.dict.itop-datacenter-mgmt.php","2.x\/itop-datacenter-mgmt\/pt_br.dict.itop-datacenter-mgmt.php","2.x\/itop-datacenter-mgmt\/nl.dict.itop-datacenter-mgmt.php"],"version_db":"","version_code":"2.7.10","install":{"flag":1,"message":""}},"itop-endusers-devices":{"label":"End-user Devices Management","category":"business","dependencies":["itop-config-mgmt\/2.2.0"],"mandatory":false,"visible":true,"installer":"EndUserMgmtInstaller","datamodel":["model.itop-endusers-devices.php"],"webservice":[],"data.struct":[],"data.sample":[],"doc.manual_setup":"","doc.more_information":"","settings":[],"itop_version":"1.0.2","root_dir":"ROOTDIR_TOREPLACEdatamodels\/2.x\/itop-endusers-devices","module_file":"ROOTDIR_TOREPLACEdatamodels\/2.x\/itop-endusers-devices\/module.itop-endusers-devices.php","dictionary":["2.x\/itop-endusers-devices\/cs.dict.itop-endusers-devices.php","2.x\/itop-endusers-devices\/en.dict.itop-endusers-devices.php","2.x\/itop-endusers-devices\/ru.dict.itop-endusers-devices.php","2.x\/itop-endusers-devices\/it.dict.itop-endusers-devices.php","2.x\/itop-endusers-devices\/sk.dict.itop-endusers-devices.php","2.x\/itop-endusers-devices\/es_cr.dict.itop-endusers-devices.php","2.x\/itop-endusers-devices\/de.dict.itop-endusers-devices.php","2.x\/itop-endusers-devices\/fr.dict.itop-endusers-devices.php","2.x\/itop-endusers-devices\/tr.dict.itop-endusers-devices.php","2.x\/itop-endusers-devices\/hu.dict.itop-endusers-devices.php","2.x\/itop-endusers-devices\/da.dict.itop-endusers-devices.php","2.x\/itop-endusers-devices\/zh_cn.dict.itop-endusers-devices.php","2.x\/itop-endusers-devices\/nl.dict.itop-endusers-devices.php","2.x\/itop-endusers-devices\/ja.dict.itop-endusers-devices.php","2.x\/itop-endusers-devices\/pt_br.dict.itop-endusers-devices.php"],"version_db":"","version_code":"2.7.10","install":{"flag":1,"message":""}},"itop-files-information":{"label":"iTop files information","category":"business","dependencies":[],"mandatory":false,"visible":false,"datamodel":["model.itop-files-information.php","src\/Service\/FilesInformation.php","src\/Service\/FilesInformationException.php","src\/Service\/FilesInformationUtils.php","src\/Service\/FilesIntegrity.php"],"webservice":[],"data.struct":[],"data.sample":[],"doc.manual_setup":"","doc.more_information":"","settings":[],"itop_version":"1.0.2","root_dir":"ROOTDIR_TOREPLACEdatamodels\/2.x\/itop-files-information","module_file":"ROOTDIR_TOREPLACEdatamodels\/2.x\/itop-files-information\/module.itop-files-information.php","dictionary":["2.x\/itop-files-information\/sk.dict.itop-files-information.php","2.x\/itop-files-information\/cs.dict.itop-files-information.php","2.x\/itop-files-information\/ja.dict.itop-files-information.php","2.x\/itop-files-information\/hu.dict.itop-files-information.php","2.x\/itop-files-information\/fr.dict.itop-files-information.php","2.x\/itop-files-information\/pt_br.dict.itop-files-information.php","2.x\/itop-files-information\/es_cr.dict.itop-files-information.php","2.x\/itop-files-information\/tr.dict.itop-files-information.php","2.x\/itop-files-information\/zh_cn.dict.itop-files-information.php","2.x\/itop-files-information\/en.dict.itop-files-information.php","2.x\/itop-files-information\/da.dict.itop-files-information.php","2.x\/itop-files-information\/de.dict.itop-files-information.php","2.x\/itop-files-information\/nl.dict.itop-files-information.php","2.x\/itop-files-information\/it.dict.itop-files-information.php","2.x\/itop-files-information\/ru.dict.itop-files-information.php"],"version_db":"","version_code":"2.7.10","install":{"flag":1,"message":""}},"itop-hub-connector":{"label":"iTop Hub Connector","category":"business","dependencies":["itop-config-mgmt\/2.4.0"],"mandatory":false,"visible":true,"datamodel":["menus.php","hubnewsroomprovider.class.inc.php","model.itop-hub-connector.php"],"webservice":[],"data.struct":[],"data.sample":[],"doc.manual_setup":"","doc.more_information":"","itop_version":"1.0.2","root_dir":"ROOTDIR_TOREPLACEdatamodels\/2.x\/itop-hub-connector","module_file":"ROOTDIR_TOREPLACEdatamodels\/2.x\/itop-hub-connector\/module.itop-hub-connector.php","dictionary":["2.x\/itop-hub-connector\/it.dict.itop-hub-connector.php","2.x\/itop-hub-connector\/zh_cn.dict.itop-hub-connector.php","2.x\/itop-hub-connector\/sk.dict.itop-hub-connector.php","2.x\/itop-hub-connector\/cs.dict.itop-hub-connector.php","2.x\/itop-hub-connector\/fr.dict.itop-hub-connector.php","2.x\/itop-hub-connector\/hu.dict.itop-hub-connector.php","2.x\/itop-hub-connector\/ru.dict.itop-hub-connector.php","2.x\/itop-hub-connector\/ja.dict.itop-hub-connector.php","2.x\/itop-hub-connector\/en.dict.itop-hub-connector.php","2.x\/itop-hub-connector\/es_cr.dict.itop-hub-connector.php","2.x\/itop-hub-connector\/tr.dict.itop-hub-connector.php","2.x\/itop-hub-connector\/nl.dict.itop-hub-connector.php","2.x\/itop-hub-connector\/de.dict.itop-hub-connector.php","2.x\/itop-hub-connector\/pt_br.dict.itop-hub-connector.php","2.x\/itop-hub-connector\/da.dict.itop-hub-connector.php"],"version_db":"","version_code":"2.7.10","install":{"flag":1,"message":""}},"itop-portal-base":{"label":"Portal Development Library","category":"Portal","dependencies":[],"mandatory":true,"visible":false,"datamodel":["portal\/vendor\/autoload.php","model.itop-portal-base.php"],"webservice":[],"dictionary":["2.x\/itop-portal-base\/hu.dict.itop-portal-base.php","2.x\/itop-portal-base\/ja.dict.itop-portal-base.php","2.x\/itop-portal-base\/cs.dict.itop-portal-base.php","2.x\/itop-portal-base\/zh_cn.dict.itop-portal-base.php","2.x\/itop-portal-base\/tr.dict.itop-portal-base.php","2.x\/itop-portal-base\/pt_br.dict.itop-portal-base.php","2.x\/itop-portal-base\/nl.dict.itop-portal-base.php","2.x\/itop-portal-base\/it.dict.itop-portal-base.php","2.x\/itop-portal-base\/es_cr.dict.itop-portal-base.php","2.x\/itop-portal-base\/fr.dict.itop-portal-base.php","2.x\/itop-portal-base\/ru.dict.itop-portal-base.php","2.x\/itop-portal-base\/de.dict.itop-portal-base.php","2.x\/itop-portal-base\/da.dict.itop-portal-base.php","2.x\/itop-portal-base\/en.dict.itop-portal-base.php","2.x\/itop-portal-base\/sk.dict.itop-portal-base.php"],"data.struct":[],"data.sample":[],"doc.manual_setup":"","doc.more_information":"","settings":[],"itop_version":"1.0.2","root_dir":"ROOTDIR_TOREPLACEdatamodels\/2.x\/itop-portal-base","module_file":"ROOTDIR_TOREPLACEdatamodels\/2.x\/itop-portal-base\/module.itop-portal-base.php","version_db":"","version_code":"2.7.10","install":{"flag":2,"message":"the module is part of the application"}},"itop-portal":{"label":"Enhanced Customer Portal","category":"Portal","dependencies":["itop-portal-base\/2.7.0"],"mandatory":false,"visible":true,"datamodel":["main.itop-portal.php","model.itop-portal.php"],"webservice":[],"dictionary":[],"data.struct":[],"data.sample":[],"doc.manual_setup":"","doc.more_information":"","settings":[],"itop_version":"1.0.2","root_dir":"ROOTDIR_TOREPLACEdatamodels\/2.x\/itop-portal","module_file":"ROOTDIR_TOREPLACEdatamodels\/2.x\/itop-portal\/module.itop-portal.php","version_db":"","version_code":"2.7.10","install":{"flag":1,"message":""}},"itop-profiles-itil":{"label":"Create standard ITIL profiles","category":"create_profiles","dependencies":[],"mandatory":true,"visible":false,"datamodel":["model.itop-profiles-itil.php"],"webservice":[],"data.struct":[],"data.sample":[],"doc.manual_setup":"","doc.more_information":"","settings":[],"itop_version":"1.0.2","root_dir":"ROOTDIR_TOREPLACEdatamodels\/2.x\/itop-profiles-itil","module_file":"ROOTDIR_TOREPLACEdatamodels\/2.x\/itop-profiles-itil\/module.itop-profiles-itil.php","version_db":"","version_code":"2.7.10","install":{"flag":2,"message":"the module is part of the application"}},"itop-sla-computation":{"label":"SLA Computation","category":"sla","dependencies":[],"mandatory":true,"visible":false,"datamodel":["main.itop-sla-computation.php"],"webservice":[],"data.struct":[],"data.sample":[],"doc.manual_setup":"","doc.more_information":"","settings":[],"itop_version":"1.0.2","root_dir":"ROOTDIR_TOREPLACEdatamodels\/2.x\/itop-sla-computation","module_file":"ROOTDIR_TOREPLACEdatamodels\/2.x\/itop-sla-computation\/module.itop-sla-computation.php","dictionary":["2.x\/itop-sla-computation\/de.dict.itop-sla-computation.php","2.x\/itop-sla-computation\/it.dict.itop-sla-computation.php","2.x\/itop-sla-computation\/tr.dict.itop-sla-computation.php","2.x\/itop-sla-computation\/nl.dict.itop-sla-computation.php","2.x\/itop-sla-computation\/zh_cn.dict.itop-sla-computation.php","2.x\/itop-sla-computation\/hu.dict.itop-sla-computation.php","2.x\/itop-sla-computation\/ja.dict.itop-sla-computation.php","2.x\/itop-sla-computation\/pt_br.dict.itop-sla-computation.php","2.x\/itop-sla-computation\/es_cr.dict.itop-sla-computation.php","2.x\/itop-sla-computation\/fr.dict.itop-sla-computation.php","2.x\/itop-sla-computation\/cs.dict.itop-sla-computation.php","2.x\/itop-sla-computation\/sk.dict.itop-sla-computation.php","2.x\/itop-sla-computation\/da.dict.itop-sla-computation.php","2.x\/itop-sla-computation\/en.dict.itop-sla-computation.php","2.x\/itop-sla-computation\/ru.dict.itop-sla-computation.php"],"version_db":"","version_code":"2.7.10","install":{"flag":2,"message":"the module is part of the application"}},"itop-storage-mgmt":{"label":"Advanced Storage Management","category":"business","dependencies":["itop-config-mgmt\/2.4.0"],"mandatory":false,"visible":true,"installer":"StorageMgmtInstaller","datamodel":["model.itop-storage-mgmt.php"],"webservice":[],"data.struct":[],"data.sample":[],"doc.manual_setup":"","doc.more_information":"","settings":[],"itop_version":"1.0.2","root_dir":"ROOTDIR_TOREPLACEdatamodels\/2.x\/itop-storage-mgmt","module_file":"ROOTDIR_TOREPLACEdatamodels\/2.x\/itop-storage-mgmt\/module.itop-storage-mgmt.php","dictionary":["2.x\/itop-storage-mgmt\/en.dict.itop-storage-mgmt.php","2.x\/itop-storage-mgmt\/cs.dict.itop-storage-mgmt.php","2.x\/itop-storage-mgmt\/ja.dict.itop-storage-mgmt.php","2.x\/itop-storage-mgmt\/da.dict.itop-storage-mgmt.php","2.x\/itop-storage-mgmt\/pt_br.dict.itop-storage-mgmt.php","2.x\/itop-storage-mgmt\/it.dict.itop-storage-mgmt.php","2.x\/itop-storage-mgmt\/nl.dict.itop-storage-mgmt.php","2.x\/itop-storage-mgmt\/fr.dict.itop-storage-mgmt.php","2.x\/itop-storage-mgmt\/tr.dict.itop-storage-mgmt.php","2.x\/itop-storage-mgmt\/es_cr.dict.itop-storage-mgmt.php","2.x\/itop-storage-mgmt\/sk.dict.itop-storage-mgmt.php","2.x\/itop-storage-mgmt\/zh_cn.dict.itop-storage-mgmt.php","2.x\/itop-storage-mgmt\/de.dict.itop-storage-mgmt.php","2.x\/itop-storage-mgmt\/hu.dict.itop-storage-mgmt.php","2.x\/itop-storage-mgmt\/ru.dict.itop-storage-mgmt.php"],"version_db":"","version_code":"2.7.10","install":{"flag":1,"message":""}},"itop-tickets":{"label":"Tickets Management","category":"business","dependencies":["itop-config-mgmt\/2.4.0"],"mandatory":true,"visible":false,"installer":"TicketsInstaller","datamodel":["main.itop-tickets.php","model.itop-tickets.php"],"data.struct":[],"data.sample":[],"doc.manual_setup":"\/documentation\/itop-tickets.htm","doc.more_information":"","settings":[],"itop_version":"1.0.2","root_dir":"ROOTDIR_TOREPLACEdatamodels\/2.x\/itop-tickets","module_file":"ROOTDIR_TOREPLACEdatamodels\/2.x\/itop-tickets\/module.itop-tickets.php","dictionary":["2.x\/itop-tickets\/cs.dict.itop-tickets.php","2.x\/itop-tickets\/da.dict.itop-tickets.php","2.x\/itop-tickets\/es_cr.dict.itop-tickets.php","2.x\/itop-tickets\/tr.dict.itop-tickets.php","2.x\/itop-tickets\/nl.dict.itop-tickets.php","2.x\/itop-tickets\/it.dict.itop-tickets.php","2.x\/itop-tickets\/en.dict.itop-tickets.php","2.x\/itop-tickets\/pt_br.dict.itop-tickets.php","2.x\/itop-tickets\/fr.dict.itop-tickets.php","2.x\/itop-tickets\/sk.dict.itop-tickets.php","2.x\/itop-tickets\/ja.dict.itop-tickets.php","2.x\/itop-tickets\/ru.dict.itop-tickets.php","2.x\/itop-tickets\/hu.dict.itop-tickets.php","2.x\/itop-tickets\/de.dict.itop-tickets.php","2.x\/itop-tickets\/zh_cn.dict.itop-tickets.php"],"version_db":"","version_code":"2.7.10","install":{"flag":2,"message":"the module is part of the application"}},"itop-virtualization-mgmt":{"label":"Virtualization Management","category":"business","dependencies":["itop-config-mgmt\/2.4.0"],"mandatory":false,"visible":true,"datamodel":["model.itop-virtualization-mgmt.php"],"webservice":[],"data.struct":[],"data.sample":["data.sample.farm.xml","data.sample.hypervisor.xml","data.sample.vm.xml","data.sample.dbserver.xml","data.sample.dbschema.xml","data.sample.webserver.xml","data.sample.webapp.xml","data.sample.applicationsolutionci.xml"],"doc.manual_setup":"","doc.more_information":"","settings":[],"itop_version":"1.0.2","root_dir":"ROOTDIR_TOREPLACEdatamodels\/2.x\/itop-virtualization-mgmt","module_file":"ROOTDIR_TOREPLACEdatamodels\/2.x\/itop-virtualization-mgmt\/module.itop-virtualization-mgmt.php","dictionary":["2.x\/itop-virtualization-mgmt\/de.dict.itop-virtualization-mgmt.php","2.x\/itop-virtualization-mgmt\/nl.dict.itop-virtualization-mgmt.php","2.x\/itop-virtualization-mgmt\/ja.dict.itop-virtualization-mgmt.php","2.x\/itop-virtualization-mgmt\/zh_cn.dict.itop-virtualization-mgmt.php","2.x\/itop-virtualization-mgmt\/ru.dict.itop-virtualization-mgmt.php","2.x\/itop-virtualization-mgmt\/sk.dict.itop-virtualization-mgmt.php","2.x\/itop-virtualization-mgmt\/tr.dict.itop-virtualization-mgmt.php","2.x\/itop-virtualization-mgmt\/fr.dict.itop-virtualization-mgmt.php","2.x\/itop-virtualization-mgmt\/cs.dict.itop-virtualization-mgmt.php","2.x\/itop-virtualization-mgmt\/da.dict.itop-virtualization-mgmt.php","2.x\/itop-virtualization-mgmt\/hu.dict.itop-virtualization-mgmt.php","2.x\/itop-virtualization-mgmt\/es_cr.dict.itop-virtualization-mgmt.php","2.x\/itop-virtualization-mgmt\/en.dict.itop-virtualization-mgmt.php","2.x\/itop-virtualization-mgmt\/pt_br.dict.itop-virtualization-mgmt.php","2.x\/itop-virtualization-mgmt\/it.dict.itop-virtualization-mgmt.php"],"version_db":"","version_code":"2.7.10","install":{"flag":1,"message":""}},"itop-welcome-itil":{"label":"ITIL skin","category":"skin","dependencies":[],"mandatory":true,"visible":false,"datamodel":["model.itop-welcome-itil.php"],"webservice":[],"data.struct":[],"data.sample":[],"doc.manual_setup":"","doc.more_information":"","settings":[],"itop_version":"1.0.2","root_dir":"ROOTDIR_TOREPLACEdatamodels\/2.x\/itop-welcome-itil","module_file":"ROOTDIR_TOREPLACEdatamodels\/2.x\/itop-welcome-itil\/module.itop-welcome-itil.php","dictionary":["2.x\/itop-welcome-itil\/da.dict.itop-welcome-itil.php","2.x\/itop-welcome-itil\/es_cr.dict.itop-welcome-itil.php","2.x\/itop-welcome-itil\/sk.dict.itop-welcome-itil.php","2.x\/itop-welcome-itil\/nl.dict.itop-welcome-itil.php","2.x\/itop-welcome-itil\/en.dict.itop-welcome-itil.php","2.x\/itop-welcome-itil\/fr.dict.itop-welcome-itil.php","2.x\/itop-welcome-itil\/ru.dict.itop-welcome-itil.php","2.x\/itop-welcome-itil\/ja.dict.itop-welcome-itil.php","2.x\/itop-welcome-itil\/de.dict.itop-welcome-itil.php","2.x\/itop-welcome-itil\/it.dict.itop-welcome-itil.php","2.x\/itop-welcome-itil\/tr.dict.itop-welcome-itil.php","2.x\/itop-welcome-itil\/hu.dict.itop-welcome-itil.php","2.x\/itop-welcome-itil\/zh_cn.dict.itop-welcome-itil.php","2.x\/itop-welcome-itil\/cs.dict.itop-welcome-itil.php","2.x\/itop-welcome-itil\/pt_br.dict.itop-welcome-itil.php"],"version_db":"","version_code":"2.7.10","install":{"flag":2,"message":"the module is part of the application"}},"itop-bridge-virtualization-storage":{"label":"Links between virtualization and storage","category":"business","dependencies":["itop-storage-mgmt\/2.2.0","itop-virtualization-mgmt\/2.2.0"],"mandatory":false,"visible":false,"auto_select":"SetupInfo::ModuleIsSelected(\"itop-storage-mgmt\") && SetupInfo::ModuleIsSelected(\"itop-virtualization-mgmt\")","datamodel":["model.itop-bridge-virtualization-storage.php"],"data.struct":[],"data.sample":[],"doc.manual_setup":"","doc.more_information":"","settings":[],"itop_version":"1.0.2","root_dir":"ROOTDIR_TOREPLACEdatamodels\/2.x\/itop-bridge-virtualization-storage","module_file":"ROOTDIR_TOREPLACEdatamodels\/2.x\/itop-bridge-virtualization-storage\/module.itop-bridge-virtualization-storage.php","version_db":"","version_code":"2.7.10","install":{"flag":1,"message":""}},"itop-change-mgmt-itil":{"label":"Change Management ITIL","category":"business","dependencies":["itop-config-mgmt\/2.2.0","itop-tickets\/2.0.0"],"mandatory":false,"visible":true,"datamodel":["model.itop-change-mgmt-itil.php"],"data.struct":[],"data.sample":[],"doc.manual_setup":"","doc.more_information":"","settings":[],"itop_version":"1.0.2","root_dir":"ROOTDIR_TOREPLACEdatamodels\/2.x\/itop-change-mgmt-itil","module_file":"ROOTDIR_TOREPLACEdatamodels\/2.x\/itop-change-mgmt-itil\/module.itop-change-mgmt-itil.php","dictionary":["2.x\/itop-change-mgmt-itil\/hu.dict.itop-change-mgmt-itil.php","2.x\/itop-change-mgmt-itil\/tr.dict.itop-change-mgmt-itil.php","2.x\/itop-change-mgmt-itil\/fr.dict.itop-change-mgmt-itil.php","2.x\/itop-change-mgmt-itil\/en.dict.itop-change-mgmt-itil.php","2.x\/itop-change-mgmt-itil\/cs.dict.itop-change-mgmt-itil.php","2.x\/itop-change-mgmt-itil\/da.dict.itop-change-mgmt-itil.php","2.x\/itop-change-mgmt-itil\/sk.dict.itop-change-mgmt-itil.php","2.x\/itop-change-mgmt-itil\/nl.dict.itop-change-mgmt-itil.php","2.x\/itop-change-mgmt-itil\/ja.dict.itop-change-mgmt-itil.php","2.x\/itop-change-mgmt-itil\/es_cr.dict.itop-change-mgmt-itil.php","2.x\/itop-change-mgmt-itil\/zh_cn.dict.itop-change-mgmt-itil.php","2.x\/itop-change-mgmt-itil\/de.dict.itop-change-mgmt-itil.php","2.x\/itop-change-mgmt-itil\/it.dict.itop-change-mgmt-itil.php","2.x\/itop-change-mgmt-itil\/ru.dict.itop-change-mgmt-itil.php","2.x\/itop-change-mgmt-itil\/pt_br.dict.itop-change-mgmt-itil.php"],"version_db":"","version_code":"2.7.10","install":{"flag":1,"message":""}},"itop-change-mgmt":{"label":"Change Management","category":"business","dependencies":["itop-config-mgmt\/2.2.0","itop-tickets\/2.0.0"],"mandatory":false,"visible":true,"installer":"ChangeManagementInstaller","datamodel":["model.itop-change-mgmt.php"],"data.struct":[],"data.sample":[],"doc.manual_setup":"","doc.more_information":"","settings":[],"itop_version":"1.0.2","root_dir":"ROOTDIR_TOREPLACEdatamodels\/2.x\/itop-change-mgmt","module_file":"ROOTDIR_TOREPLACEdatamodels\/2.x\/itop-change-mgmt\/module.itop-change-mgmt.php","dictionary":["2.x\/itop-change-mgmt\/zh_cn.dict.itop-change-mgmt.php","2.x\/itop-change-mgmt\/en.dict.itop-change-mgmt.php","2.x\/itop-change-mgmt\/tr.dict.itop-change-mgmt.php","2.x\/itop-change-mgmt\/it.dict.itop-change-mgmt.php","2.x\/itop-change-mgmt\/cs.dict.itop-change-mgmt.php","2.x\/itop-change-mgmt\/hu.dict.itop-change-mgmt.php","2.x\/itop-change-mgmt\/ja.dict.itop-change-mgmt.php","2.x\/itop-change-mgmt\/da.dict.itop-change-mgmt.php","2.x\/itop-change-mgmt\/es_cr.dict.itop-change-mgmt.php","2.x\/itop-change-mgmt\/de.dict.itop-change-mgmt.php","2.x\/itop-change-mgmt\/nl.dict.itop-change-mgmt.php","2.x\/itop-change-mgmt\/sk.dict.itop-change-mgmt.php","2.x\/itop-change-mgmt\/ru.dict.itop-change-mgmt.php","2.x\/itop-change-mgmt\/pt_br.dict.itop-change-mgmt.php","2.x\/itop-change-mgmt\/fr.dict.itop-change-mgmt.php"],"version_db":"","version_code":"2.7.10","install":{"flag":1,"message":""}},"itop-core-update":{"label":"iTop Core Update","category":"business","dependencies":["itop-files-information\/2.7.0","combodo-db-tools\/2.7.0"],"mandatory":false,"visible":true,"datamodel":["model.itop-core-update.php","src\/Service\/RunTimeEnvironmentCoreUpdater.php","src\/Service\/CoreUpdater.php","src\/Controller\/UpdateController.php","src\/Controller\/AjaxController.php"],"webservice":[],"data.struct":[],"data.sample":[],"doc.manual_setup":"","doc.more_information":"","settings":[],"itop_version":"1.0.2","root_dir":"ROOTDIR_TOREPLACEdatamodels\/2.x\/itop-core-update","module_file":"ROOTDIR_TOREPLACEdatamodels\/2.x\/itop-core-update\/module.itop-core-update.php","dictionary":["2.x\/itop-core-update\/ru.dict.itop-core-update.php","2.x\/itop-core-update\/de.dict.itop-core-update.php","2.x\/itop-core-update\/hu.dict.itop-core-update.php","2.x\/itop-core-update\/es_cr.dict.itop-core-update.php","2.x\/itop-core-update\/cs.dict.itop-core-update.php","2.x\/itop-core-update\/sk.dict.itop-core-update.php","2.x\/itop-core-update\/zh_cn.dict.itop-core-update.php","2.x\/itop-core-update\/fr.dict.itop-core-update.php","2.x\/itop-core-update\/da.dict.itop-core-update.php","2.x\/itop-core-update\/it.dict.itop-core-update.php","2.x\/itop-core-update\/pt_br.dict.itop-core-update.php","2.x\/itop-core-update\/en.dict.itop-core-update.php","2.x\/itop-core-update\/nl.dict.itop-core-update.php","2.x\/itop-core-update\/tr.dict.itop-core-update.php","2.x\/itop-core-update\/ja.dict.itop-core-update.php"],"version_db":"","version_code":"2.7.10","install":{"flag":1,"message":""}},"itop-incident-mgmt-itil":{"label":"Incident Management ITIL","category":"business","dependencies":["itop-config-mgmt\/2.4.0","itop-tickets\/2.4.0","itop-profiles-itil\/2.3.0"],"mandatory":false,"visible":true,"datamodel":["model.itop-incident-mgmt-itil.php"],"data.struct":[],"data.sample":[],"doc.manual_setup":"","doc.more_information":"","settings":[],"itop_version":"1.0.2","root_dir":"ROOTDIR_TOREPLACEdatamodels\/2.x\/itop-incident-mgmt-itil","module_file":"ROOTDIR_TOREPLACEdatamodels\/2.x\/itop-incident-mgmt-itil\/module.itop-incident-mgmt-itil.php","dictionary":["2.x\/itop-incident-mgmt-itil\/da.dict.itop-incident-mgmt-itil.php","2.x\/itop-incident-mgmt-itil\/en.dict.itop-incident-mgmt-itil.php","2.x\/itop-incident-mgmt-itil\/de.dict.itop-incident-mgmt-itil.php","2.x\/itop-incident-mgmt-itil\/zh_cn.dict.itop-incident-mgmt-itil.php","2.x\/itop-incident-mgmt-itil\/sk.dict.itop-incident-mgmt-itil.php","2.x\/itop-incident-mgmt-itil\/fr.dict.itop-incident-mgmt-itil.php","2.x\/itop-incident-mgmt-itil\/hu.dict.itop-incident-mgmt-itil.php","2.x\/itop-incident-mgmt-itil\/ja.dict.itop-incident-mgmt-itil.php","2.x\/itop-incident-mgmt-itil\/cs.dict.itop-incident-mgmt-itil.php","2.x\/itop-incident-mgmt-itil\/nl.dict.itop-incident-mgmt-itil.php","2.x\/itop-incident-mgmt-itil\/ru.dict.itop-incident-mgmt-itil.php","2.x\/itop-incident-mgmt-itil\/tr.dict.itop-incident-mgmt-itil.php","2.x\/itop-incident-mgmt-itil\/it.dict.itop-incident-mgmt-itil.php","2.x\/itop-incident-mgmt-itil\/pt_br.dict.itop-incident-mgmt-itil.php","2.x\/itop-incident-mgmt-itil\/es_cr.dict.itop-incident-mgmt-itil.php"],"version_db":"","version_code":"2.7.10","install":{"flag":1,"message":""}},"itop-knownerror-mgmt":{"label":"Known Errors Database","category":"business","dependencies":["itop-config-mgmt\/2.2.0","itop-tickets\/2.3.0"],"mandatory":false,"visible":true,"installer":"KnownErrorMgmtInstaller","datamodel":["model.itop-knownerror-mgmt.php"],"data.struct":[],"data.sample":["data.sample.faq-domains.xml"],"doc.manual_setup":"","doc.more_information":"","settings":[],"itop_version":"1.0.2","root_dir":"ROOTDIR_TOREPLACEdatamodels\/2.x\/itop-knownerror-mgmt","module_file":"ROOTDIR_TOREPLACEdatamodels\/2.x\/itop-knownerror-mgmt\/module.itop-knownerror-mgmt.php","dictionary":["2.x\/itop-knownerror-mgmt\/hu.dict.itop-knownerror-mgmt.php","2.x\/itop-knownerror-mgmt\/nl.dict.itop-knownerror-mgmt.php","2.x\/itop-knownerror-mgmt\/cs.dict.itop-knownerror-mgmt.php","2.x\/itop-knownerror-mgmt\/es_cr.dict.itop-knownerror-mgmt.php","2.x\/itop-knownerror-mgmt\/fr.dict.itop-knownerror-mgmt.php","2.x\/itop-knownerror-mgmt\/ru.dict.itop-knownerror-mgmt.php","2.x\/itop-knownerror-mgmt\/en.dict.itop-knownerror-mgmt.php","2.x\/itop-knownerror-mgmt\/da.dict.itop-knownerror-mgmt.php","2.x\/itop-knownerror-mgmt\/it.dict.itop-knownerror-mgmt.php","2.x\/itop-knownerror-mgmt\/sk.dict.itop-knownerror-mgmt.php","2.x\/itop-knownerror-mgmt\/pt_br.dict.itop-knownerror-mgmt.php","2.x\/itop-knownerror-mgmt\/tr.dict.itop-knownerror-mgmt.php","2.x\/itop-knownerror-mgmt\/zh_cn.dict.itop-knownerror-mgmt.php","2.x\/itop-knownerror-mgmt\/de.dict.itop-knownerror-mgmt.php","2.x\/itop-knownerror-mgmt\/ja.dict.itop-knownerror-mgmt.php"],"version_db":"","version_code":"2.7.10","install":{"flag":1,"message":""}},"itop-oauth-client":{"label":"OAuth 2.0 client","category":"business","dependencies":["itop-welcome-itil\/2.7.7,"],"mandatory":false,"visible":true,"datamodel":["vendor\/autoload.php","model.itop-oauth-client.php","src\/Service\/PopupMenuExtension.php","src\/Service\/ApplicationUIExtension.php"],"webservice":[],"data.struct":[],"data.sample":[],"doc.manual_setup":"","doc.more_information":"","settings":[],"itop_version":"1.0.2","root_dir":"ROOTDIR_TOREPLACEdatamodels\/2.x\/itop-oauth-client","module_file":"ROOTDIR_TOREPLACEdatamodels\/2.x\/itop-oauth-client\/module.itop-oauth-client.php","dictionary":["2.x\/itop-oauth-client\/tr.dict.itop-oauth-client.php","2.x\/itop-oauth-client\/fr.dict.itop-oauth-client.php","2.x\/itop-oauth-client\/it.dict.itop-oauth-client.php","2.x\/itop-oauth-client\/en.dict.itop-oauth-client.php","2.x\/itop-oauth-client\/cs.dict.itop-oauth-client.php","2.x\/itop-oauth-client\/sk.dict.itop-oauth-client.php","2.x\/itop-oauth-client\/ru.dict.itop-oauth-client.php","2.x\/itop-oauth-client\/zh_cn.dict.itop-oauth-client.php","2.x\/itop-oauth-client\/pt_br.dict.itop-oauth-client.php","2.x\/itop-oauth-client\/es_cr.dict.itop-oauth-client.php","2.x\/itop-oauth-client\/nl.dict.itop-oauth-client.php","2.x\/itop-oauth-client\/ja.dict.itop-oauth-client.php","2.x\/itop-oauth-client\/de.dict.itop-oauth-client.php","2.x\/itop-oauth-client\/hu.dict.itop-oauth-client.php","2.x\/itop-oauth-client\/da.dict.itop-oauth-client.php"],"version_db":"","version_code":"2.7.10","install":{"flag":1,"message":""}},"itop-problem-mgmt":{"label":"Problem Management","category":"business","dependencies":["itop-config-mgmt\/2.2.0","itop-tickets\/2.0.0"],"mandatory":false,"visible":true,"datamodel":["model.itop-problem-mgmt.php"],"data.struct":[],"data.sample":[],"doc.manual_setup":"","doc.more_information":"","settings":[],"itop_version":"1.0.2","root_dir":"ROOTDIR_TOREPLACEdatamodels\/2.x\/itop-problem-mgmt","module_file":"ROOTDIR_TOREPLACEdatamodels\/2.x\/itop-problem-mgmt\/module.itop-problem-mgmt.php","dictionary":["2.x\/itop-problem-mgmt\/tr.dict.itop-problem-mgmt.php","2.x\/itop-problem-mgmt\/cs.dict.itop-problem-mgmt.php","2.x\/itop-problem-mgmt\/sk.dict.itop-problem-mgmt.php","2.x\/itop-problem-mgmt\/pt_br.dict.itop-problem-mgmt.php","2.x\/itop-problem-mgmt\/es_cr.dict.itop-problem-mgmt.php","2.x\/itop-problem-mgmt\/da.dict.itop-problem-mgmt.php","2.x\/itop-problem-mgmt\/ru.dict.itop-problem-mgmt.php","2.x\/itop-problem-mgmt\/en.dict.itop-problem-mgmt.php","2.x\/itop-problem-mgmt\/hu.dict.itop-problem-mgmt.php","2.x\/itop-problem-mgmt\/fr.dict.itop-problem-mgmt.php","2.x\/itop-problem-mgmt\/nl.dict.itop-problem-mgmt.php","2.x\/itop-problem-mgmt\/ja.dict.itop-problem-mgmt.php","2.x\/itop-problem-mgmt\/de.dict.itop-problem-mgmt.php","2.x\/itop-problem-mgmt\/zh_cn.dict.itop-problem-mgmt.php","2.x\/itop-problem-mgmt\/it.dict.itop-problem-mgmt.php"],"version_db":"","version_code":"2.7.10","install":{"flag":1,"message":""}},"itop-request-mgmt-itil":{"label":"User request Management ITIL","category":"business","dependencies":["itop-config-mgmt\/2.4.0","itop-tickets\/2.4.0"],"mandatory":false,"visible":true,"datamodel":["model.itop-request-mgmt-itil.php","main.itop-request-mgmt-itil.php"],"data.struct":[],"data.sample":[],"doc.manual_setup":"","doc.more_information":"","settings":[],"itop_version":"1.0.2","root_dir":"ROOTDIR_TOREPLACEdatamodels\/2.x\/itop-request-mgmt-itil","module_file":"ROOTDIR_TOREPLACEdatamodels\/2.x\/itop-request-mgmt-itil\/module.itop-request-mgmt-itil.php","dictionary":["2.x\/itop-request-mgmt-itil\/ja.dict.itop-request-mgmt-itil.php","2.x\/itop-request-mgmt-itil\/hu.dict.itop-request-mgmt-itil.php","2.x\/itop-request-mgmt-itil\/fr.dict.itop-request-mgmt-itil.php","2.x\/itop-request-mgmt-itil\/nl.dict.itop-request-mgmt-itil.php","2.x\/itop-request-mgmt-itil\/ru.dict.itop-request-mgmt-itil.php","2.x\/itop-request-mgmt-itil\/zh_cn.dict.itop-request-mgmt-itil.php","2.x\/itop-request-mgmt-itil\/it.dict.itop-request-mgmt-itil.php","2.x\/itop-request-mgmt-itil\/pt_br.dict.itop-request-mgmt-itil.php","2.x\/itop-request-mgmt-itil\/sk.dict.itop-request-mgmt-itil.php","2.x\/itop-request-mgmt-itil\/tr.dict.itop-request-mgmt-itil.php","2.x\/itop-request-mgmt-itil\/es_cr.dict.itop-request-mgmt-itil.php","2.x\/itop-request-mgmt-itil\/de.dict.itop-request-mgmt-itil.php","2.x\/itop-request-mgmt-itil\/en.dict.itop-request-mgmt-itil.php","2.x\/itop-request-mgmt-itil\/cs.dict.itop-request-mgmt-itil.php","2.x\/itop-request-mgmt-itil\/da.dict.itop-request-mgmt-itil.php"],"version_db":"","version_code":"2.7.10","install":{"flag":1,"message":""}},"itop-request-mgmt":{"label":"Simple Ticket Management","category":"business","dependencies":["itop-config-mgmt\/2.4.0","itop-tickets\/2.4.0"],"mandatory":false,"visible":true,"datamodel":["model.itop-request-mgmt.php","main.itop-request-mgmt.php"],"data.struct":[],"data.sample":[],"doc.manual_setup":"","doc.more_information":"","settings":[],"itop_version":"1.0.2","root_dir":"ROOTDIR_TOREPLACEdatamodels\/2.x\/itop-request-mgmt","module_file":"ROOTDIR_TOREPLACEdatamodels\/2.x\/itop-request-mgmt\/module.itop-request-mgmt.php","dictionary":["2.x\/itop-request-mgmt\/tr.dict.itop-request-mgmt.php","2.x\/itop-request-mgmt\/da.dict.itop-request-mgmt.php","2.x\/itop-request-mgmt\/it.dict.itop-request-mgmt.php","2.x\/itop-request-mgmt\/fr.dict.itop-request-mgmt.php","2.x\/itop-request-mgmt\/ru.dict.itop-request-mgmt.php","2.x\/itop-request-mgmt\/cs.dict.itop-request-mgmt.php","2.x\/itop-request-mgmt\/hu.dict.itop-request-mgmt.php","2.x\/itop-request-mgmt\/en.dict.itop-request-mgmt.php","2.x\/itop-request-mgmt\/sk.dict.itop-request-mgmt.php","2.x\/itop-request-mgmt\/pt_br.dict.itop-request-mgmt.php","2.x\/itop-request-mgmt\/zh_cn.dict.itop-request-mgmt.php","2.x\/itop-request-mgmt\/de.dict.itop-request-mgmt.php","2.x\/itop-request-mgmt\/es_cr.dict.itop-request-mgmt.php","2.x\/itop-request-mgmt\/nl.dict.itop-request-mgmt.php","2.x\/itop-request-mgmt\/ja.dict.itop-request-mgmt.php"],"version_db":"","version_code":"2.7.10","install":{"flag":1,"message":""}},"itop-service-mgmt-provider":{"label":"Service Management for Service Providers","category":"business","dependencies":["itop-config-mgmt\/2.2.0","itop-tickets\/2.0.0"],"mandatory":false,"visible":true,"installer":"ServiceMgmtProviderInstaller","datamodel":["model.itop-service-mgmt-provider.php"],"data.struct":[],"data.sample":["data.sample.organizations.xml","data.sample.contracts.xml","data.sample.servicefamilies.xml","data.sample.services.xml","data.sample.serviceelements.xml","data.sample.sla.xml","data.sample.slt.xml","data.sample.sltsla.xml","data.sample.contractservice.xml","data.sample.deliverymodelcontact.xml"],"doc.manual_setup":"","doc.more_information":"","settings":[],"itop_version":"1.0.2","root_dir":"ROOTDIR_TOREPLACEdatamodels\/2.x\/itop-service-mgmt-provider","module_file":"ROOTDIR_TOREPLACEdatamodels\/2.x\/itop-service-mgmt-provider\/module.itop-service-mgmt-provider.php","dictionary":["2.x\/itop-service-mgmt-provider\/zh_cn.dict.itop-service-mgmt-provider.php","2.x\/itop-service-mgmt-provider\/tr.dict.itop-service-mgmt-provider.php","2.x\/itop-service-mgmt-provider\/sk.dict.itop-service-mgmt-provider.php","2.x\/itop-service-mgmt-provider\/de.dict.itop-service-mgmt-provider.php","2.x\/itop-service-mgmt-provider\/ja.dict.itop-service-mgmt-provider.php","2.x\/itop-service-mgmt-provider\/ru.dict.itop-service-mgmt-provider.php","2.x\/itop-service-mgmt-provider\/fr.dict.itop-service-mgmt-provider.php","2.x\/itop-service-mgmt-provider\/hu.dict.itop-service-mgmt-provider.php","2.x\/itop-service-mgmt-provider\/en.dict.itop-service-mgmt-provider.php","2.x\/itop-service-mgmt-provider\/it.dict.itop-service-mgmt-provider.php","2.x\/itop-service-mgmt-provider\/cs.dict.itop-service-mgmt-provider.php","2.x\/itop-service-mgmt-provider\/es_cr.dict.itop-service-mgmt-provider.php","2.x\/itop-service-mgmt-provider\/pt_br.dict.itop-service-mgmt-provider.php","2.x\/itop-service-mgmt-provider\/da.dict.itop-service-mgmt-provider.php","2.x\/itop-service-mgmt-provider\/nl.dict.itop-service-mgmt-provider.php"],"version_db":"","version_code":"2.7.10","install":{"flag":1,"message":""}},"itop-service-mgmt":{"label":"Service Management","category":"business","dependencies":["itop-config-mgmt\/2.2.0","itop-tickets\/2.0.0"],"mandatory":false,"visible":true,"installer":"ServiceMgmtInstaller","datamodel":["model.itop-service-mgmt.php"],"data.struct":[],"data.sample":["data.sample.organizations.xml","data.sample.contracts.xml","data.sample.servicefamilies.xml","data.sample.services.xml","data.sample.serviceelements.xml","data.sample.sla.xml","data.sample.slt.xml","data.sample.sltsla.xml","data.sample.contractservice.xml","data.sample.deliverymodelcontact.xml"],"doc.manual_setup":"","doc.more_information":"","settings":[],"itop_version":"1.0.2","root_dir":"ROOTDIR_TOREPLACEdatamodels\/2.x\/itop-service-mgmt","module_file":"ROOTDIR_TOREPLACEdatamodels\/2.x\/itop-service-mgmt\/module.itop-service-mgmt.php","dictionary":["2.x\/itop-service-mgmt\/hu.dict.itop-service-mgmt.php","2.x\/itop-service-mgmt\/es_cr.dict.itop-service-mgmt.php","2.x\/itop-service-mgmt\/nl.dict.itop-service-mgmt.php","2.x\/itop-service-mgmt\/sk.dict.itop-service-mgmt.php","2.x\/itop-service-mgmt\/it.dict.itop-service-mgmt.php","2.x\/itop-service-mgmt\/da.dict.itop-service-mgmt.php","2.x\/itop-service-mgmt\/zh_cn.dict.itop-service-mgmt.php","2.x\/itop-service-mgmt\/tr.dict.itop-service-mgmt.php","2.x\/itop-service-mgmt\/en.dict.itop-service-mgmt.php","2.x\/itop-service-mgmt\/cs.dict.itop-service-mgmt.php","2.x\/itop-service-mgmt\/de.dict.itop-service-mgmt.php","2.x\/itop-service-mgmt\/ja.dict.itop-service-mgmt.php","2.x\/itop-service-mgmt\/ru.dict.itop-service-mgmt.php","2.x\/itop-service-mgmt\/pt_br.dict.itop-service-mgmt.php","2.x\/itop-service-mgmt\/fr.dict.itop-service-mgmt.php"],"version_db":"","version_code":"2.7.10","install":{"flag":1,"message":""}},"itop-full-itil":{"label":"Bridge - Request management ITIL + Incident management ITIL","category":"business","dependencies":["itop-request-mgmt-itil\/2.3.0","itop-incident-mgmt-itil\/2.3.0"],"mandatory":false,"visible":false,"auto_select":"SetupInfo::ModuleIsSelected(\"itop-request-mgmt-itil\") && SetupInfo::ModuleIsSelected(\"itop-incident-mgmt-itil\")","datamodel":[],"webservice":[],"data.struct":[],"data.sample":[],"doc.manual_setup":"","doc.more_information":"","settings":[],"itop_version":"1.0.2","root_dir":"ROOTDIR_TOREPLACEdatamodels\/2.x\/itop-full-itil","module_file":"ROOTDIR_TOREPLACEdatamodels\/2.x\/itop-full-itil\/module.itop-full-itil.php","version_db":"","version_code":"2.7.10","install":{"flag":1,"message":""}}} diff --git a/tests/php-unit-tests/unitary-tests/setup/unattended-install/installation.xml b/tests/php-unit-tests/unitary-tests/setup/unattended-install/resources/installation.xml similarity index 100% rename from tests/php-unit-tests/unitary-tests/setup/unattended-install/installation.xml rename to tests/php-unit-tests/unitary-tests/setup/unattended-install/resources/installation.xml From 7ab258ba03fb6d0a6afe586d82a5761526eab464 Mon Sep 17 00:00:00 2001 From: odain Date: Fri, 12 Apr 2024 11:31:50 +0200 Subject: [PATCH 2/6] =?UTF-8?q?N=C2=B07439=20-=20setup=20wizard=20broken?= =?UTF-8?q?=20on=20essential=20targets?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../InstallationFileService.php | 11 ++- .../unattended-install/unattended-install.php | 15 +++- .../InstallationFileServiceTest.php | 83 ++++++++++++++++++- 3 files changed, 104 insertions(+), 5 deletions(-) diff --git a/setup/unattended-install/InstallationFileService.php b/setup/unattended-install/InstallationFileService.php index 301fd8ba2..77dad4cbd 100644 --- a/setup/unattended-install/InstallationFileService.php +++ b/setup/unattended-install/InstallationFileService.php @@ -21,6 +21,7 @@ class InstallationFileService { private $sInstallationPath; private $aSelectedModules; private $aSelectedExtensions; + private $aAfterComputationSelectedExtensions; private $aUnSelectedModules; private $aAutoSelectModules; private $bInstallationOptionalChoicesChecked; @@ -37,6 +38,7 @@ class InstallationFileService { $this->aUnSelectedModules = []; $this->sTargetEnvironment = $sTargetEnvironment; $this->aSelectedExtensions = $aSelectedExtensions; + $this->aAfterComputationSelectedExtensions = (count($aSelectedExtensions)==0) ? [] : $aSelectedExtensions; $this->bInstallationOptionalChoicesChecked = $bInstallationOptionalChoicesChecked; } @@ -51,6 +53,10 @@ class InstallationFileService { $this->oProductionEnv = $oProductionEnv; } + public function GetAfterComputationSelectedExtensions(): array { + return $this->aAfterComputationSelectedExtensions; + } + public function GetAutoSelectModules(): array { return $this->aAutoSelectModules; } @@ -146,10 +152,13 @@ class InstallationFileService { $sMandatory = $aChoiceInfo["mandatory"] ?? "false"; $aCurrentModules = $aChoiceInfo["modules"] ?? []; + $sExtensionCode = $aChoiceInfo["extension_code"] ?? null; if (0 === count($this->aSelectedExtensions)){ $bSelected = $bAllChecked || $sDefault === "true" || $sMandatory === "true"; + if ($bSelected){ + $this->aAfterComputationSelectedExtensions[]= $sExtensionCode; + } } else { - $sExtensionCode = $aChoiceInfo["extension_code"] ?? null; $bSelected = $sMandatory === "true" || (null !== $sExtensionCode && in_array($sExtensionCode, $this->aSelectedExtensions)); } diff --git a/setup/unattended-install/unattended-install.php b/setup/unattended-install/unattended-install.php index 10dc03fc0..5a630381d 100644 --- a/setup/unattended-install/unattended-install.php +++ b/setup/unattended-install/unattended-install.php @@ -63,7 +63,8 @@ if (! is_null($sInstallationXmlPath) && is_file($sInstallationXmlPath)) { $sInstallationBaseName = basename($sInstallationXmlPath); $aSelectedExtensionsFromXmlSetup = $oParams->Get('selected_extensions', []); - if (count($aSelectedExtensionsFromXmlSetup) !== 0) { + $bInstallationChoicesProvided = count($aSelectedExtensionsFromXmlSetup) !== 0; + if ($bInstallationChoicesProvided) { $sMsg = "Modules to install computed based on $sInstallationBaseName file and installation choices (listed in section `selected_extensions` of $sXmlSetupBaseName file)"; echo "$sMsg:\n".implode(',', $aSelectedExtensionsFromXmlSetup)."\n\n"; SetupLog::Info($sMsg, null, $aSelectedExtensionsFromXmlSetup); @@ -75,11 +76,21 @@ if (! is_null($sInstallationXmlPath) && is_file($sInstallationXmlPath)) { $oInstallationFileService = new InstallationFileService($sInstallationXmlPath, $sTargetEnvironment, $aSelectedExtensionsFromXmlSetup); $oInstallationFileService->Init(); + + $aComputedExtensions = $oInstallationFileService->GetAfterComputationSelectedExtensions(); + if (! $bInstallationChoicesProvided) { + $sMsg = "Computed installation choices"; + echo "$sMsg:\n".implode(',', $aComputedExtensions)."\n\n"; + SetupLog::Info($sMsg, null, $aComputedExtensions); + } + $aSelectedExtensions = array_keys($aComputedExtensions); + $oParams->Set('selected_extensions', $aSelectedExtensions); + $aComputedModules = $oInstallationFileService->GetSelectedModules(); $aSelectedModules = array_keys($aComputedModules); $oParams->Set('selected_modules', $aSelectedModules); - $sMsg = "Modules to install computed"; + $sMsg = "Computed modules to install"; } else { $aSelectedModules = $oParams->Get('selected_modules', []); $sMsg = "Modules to install listed in $sXmlSetupBaseName (selected_modules section)"; diff --git a/tests/php-unit-tests/unitary-tests/setup/unattended-install/InstallationFileServiceTest.php b/tests/php-unit-tests/unitary-tests/setup/unattended-install/InstallationFileServiceTest.php index 272e913e2..9aefa4237 100644 --- a/tests/php-unit-tests/unitary-tests/setup/unattended-install/InstallationFileServiceTest.php +++ b/tests/php-unit-tests/unitary-tests/setup/unattended-install/InstallationFileServiceTest.php @@ -195,12 +195,34 @@ class InstallationFileServiceTest extends ItopTestCase { sort($aExpectedUnselectedModules); sort($aUnselectedModules); $this->assertEquals($aExpectedUnselectedModules, $aUnselectedModules); + + $aGetAfterComputationSelectedExtensions = $oInstallationFileService->GetAfterComputationSelectedExtensions(); + sort($aGetAfterComputationSelectedExtensions); + $aExpectedExtensions = [ + 'itop-change-mgmt-simple', + 'itop-config-mgmt-core', + 'itop-config-mgmt-datacenter', + 'itop-config-mgmt-end-user', + 'itop-config-mgmt-storage', + 'itop-config-mgmt-virtualization', + 'itop-service-mgmt-enterprise', + 'itop-ticket-mgmt-simple-ticket', + 'itop-ticket-mgmt-simple-ticket-enhanced-portal', + ]; + if ($bInstallationOptionalChoicesChecked){ + $aExpectedExtensions []= "itop-problem-mgmt"; + $aExpectedExtensions []= 'itop-kown-error-mgmt'; + } + sort($aExpectedExtensions); + $this->assertEquals($aExpectedExtensions, $aGetAfterComputationSelectedExtensions); + + $this->ValidateNonItilExtensionComputation($oInstallationFileService, $bInstallationOptionalChoicesChecked); } /** * @dataProvider ItilExtensionProvider */ - public function testProcessInstallationChoicesWithItilChoices(array $aSelectedExtensions, bool $bKnownMgtSelected) { + public function testProcessInstallationChoicesWithItilChoices(array $aSelectedExtensions, bool $bKnownMgtSelected, bool $bCoreMgtSelected) { $sPath = $this->GetInstallationPath(); $oInstallationFileService = new \InstallationFileService($sPath, 'production', $aSelectedExtensions, false); $oProductionEnv = $this->createMock(\RunTimeEnvironment::class); @@ -255,6 +277,8 @@ class InstallationFileServiceTest extends ItopTestCase { sort($aExpectedUnselectedModules); sort($aUnselectedModules); $this->assertEquals($aExpectedUnselectedModules, $aUnselectedModules); + + $this->ValidateItilExtensionComputation($oInstallationFileService, $bKnownMgtSelected, $bCoreMgtSelected); } public function GetDefaultModulesProvider() { @@ -334,6 +358,55 @@ class InstallationFileServiceTest extends ItopTestCase { $this->checkModuleList("unvisible", $aUnvisibleModules, $aSelectedModules); $this->checkModuleList("auto-select", $aAutoSelectedModules, $aSelectedModules); $this->assertEquals([], $aSelectedModules, "there should be no more modules remaining apart from below lists"); + + $this->ValidateNonItilExtensionComputation($oInstallationFileService, $bInstallationOptionalChoicesChecked); + } + + private function ValidateNonItilExtensionComputation($oInstallationFileService, bool $bInstallationOptionalChoicesChecked) { + $aGetAfterComputationSelectedExtensions = $oInstallationFileService->GetAfterComputationSelectedExtensions(); + sort($aGetAfterComputationSelectedExtensions); + $aExpectedExtensions = [ + 'itop-change-mgmt-simple', + 'itop-config-mgmt-core', + 'itop-config-mgmt-datacenter', + 'itop-config-mgmt-end-user', + 'itop-config-mgmt-storage', + 'itop-config-mgmt-virtualization', + 'itop-service-mgmt-enterprise', + 'itop-ticket-mgmt-simple-ticket', + 'itop-ticket-mgmt-simple-ticket-enhanced-portal', + ]; + if ($bInstallationOptionalChoicesChecked){ + $aExpectedExtensions []= "itop-problem-mgmt"; + $aExpectedExtensions []= 'itop-kown-error-mgmt'; + } + sort($aExpectedExtensions); + $this->assertEquals($aExpectedExtensions, $aGetAfterComputationSelectedExtensions); + } + + private function ValidateItilExtensionComputation($oInstallationFileService, bool $bKnownMgtSelected, bool $bCoreMgtSelected) { + $aGetAfterComputationSelectedExtensions = $oInstallationFileService->GetAfterComputationSelectedExtensions(); + sort($aGetAfterComputationSelectedExtensions); + $aExpectedExtensions = [ + 'itop-change-mgmt-itil', + 'itop-config-mgmt-datacenter', + 'itop-config-mgmt-end-user', + 'itop-config-mgmt-storage', + 'itop-config-mgmt-virtualization', + 'itop-service-mgmt-enterprise', + 'itop-ticket-mgmt-itil', + 'itop-ticket-mgmt-itil-enhanced-portal', + 'itop-ticket-mgmt-itil-incident', + 'itop-ticket-mgmt-itil-user-request', + ]; + if ($bCoreMgtSelected){ + $aExpectedExtensions []= 'itop-config-mgmt-core'; + } + if ($bKnownMgtSelected){ + $aExpectedExtensions []= 'itop-kown-error-mgmt'; + } + sort($aExpectedExtensions); + $this->assertEquals($aExpectedExtensions, $aGetAfterComputationSelectedExtensions); } private function GetSelectedItilExtensions(bool $coreExtensionIncluded, bool $bKnownMgtIncluded) : array { @@ -367,18 +440,22 @@ class InstallationFileServiceTest extends ItopTestCase { 'all itil extensions + INCLUDING known-error-mgt' => [ 'aSelectedExtensions' => $this->GetSelectedItilExtensions(true, true), 'bKnownMgtSelected' => true, + 'bCoreMgtSelected' => true, ], 'all itil extensions WITHOUT known-error-mgt' => [ 'aSelectedExtensions' => $this->GetSelectedItilExtensions(true, false), 'bKnownMgtSelected' => false, + 'bCoreMgtSelected' => true, ], 'all itil extensions WITHOUT core mandatory ones + INCLUDING known-error-mgt' => [ 'aSelectedExtensions' => $this->GetSelectedItilExtensions(false, true), 'bKnownMgtSelected' => true, + 'bCoreMgtSelected' => false, ], 'all itil extensions WITHOUT core mandatory ones and WITHOUT known-error-mgt' => [ 'aSelectedExtensions' => $this->GetSelectedItilExtensions(false, false), 'bKnownMgtSelected' => false, + 'bCoreMgtSelected' => false, ], ]; } @@ -386,7 +463,7 @@ class InstallationFileServiceTest extends ItopTestCase { /** * @dataProvider ItilExtensionProvider */ - public function testGetAllSelectedModules_withItilExtensions(array $aSelectedExtensions, bool $bKnownMgtSelected) { + public function testGetAllSelectedModules_withItilExtensions(array $aSelectedExtensions, bool $bKnownMgtSelected, bool $bCoreMgtSelected) { $sPath = $this->GetInstallationPath(); $oInstallationFileService = new \InstallationFileService($sPath, 'production', $aSelectedExtensions); @@ -448,6 +525,8 @@ class InstallationFileServiceTest extends ItopTestCase { $this->checkModuleList("unvisible", $aUnvisibleModules, $aSelectedModules); $this->checkModuleList("auto-select", $aAutoSelectedModules, $aSelectedModules); $this->assertEquals([], $aSelectedModules, "there should be no more modules remaining apart from below lists"); + + $this->ValidateItilExtensionComputation($oInstallationFileService, $bKnownMgtSelected, $bCoreMgtSelected); } private function checkModuleList(string $sModuleCategory, array $aExpectedModuleList, array &$aSelectedModules) { From 6653ab06683a53b3fc0906d932b7e42e45ffb3dd Mon Sep 17 00:00:00 2001 From: odain Date: Fri, 12 Apr 2024 13:25:40 +0200 Subject: [PATCH 3/6] =?UTF-8?q?N=C2=B07407=20-=20fix=20missing=20extension?= =?UTF-8?q?=20installation=20via=20unattended=20from=20production-modules?= =?UTF-8?q?=20or=20extension=20folder?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../InstallationFileService.php | 106 ++++++- .../InstallationFileServiceTest.php | 271 ++++++++++++++++-- 2 files changed, 352 insertions(+), 25 deletions(-) diff --git a/setup/unattended-install/InstallationFileService.php b/setup/unattended-install/InstallationFileService.php index 77dad4cbd..c73a13fe1 100644 --- a/setup/unattended-install/InstallationFileService.php +++ b/setup/unattended-install/InstallationFileService.php @@ -17,6 +17,9 @@ class InstallationFileService { /** @var \RunTimeEnvironment $oProductionEnv */ private $oProductionEnv; + /** @var \ItopExtensionsMap $oProductionEnv */ + private $oItopExtensionsMap; + private $sTargetEnvironment; private $sInstallationPath; private $aSelectedModules; @@ -30,7 +33,8 @@ class InstallationFileService { * @param string $sInstallationPath * @param string $sTargetEnvironment * @param array $aSelectedExtensions - * @param bool $bInstallationOptionalChoicesChecked : this option is used only when no extensions are selected (ie empty $aSelectedExtensions) + * @param bool $bInstallationOptionalChoicesChecked : this option is used only when no extensions are selected (ie empty + * $aSelectedExtensions) */ public function __construct(string $sInstallationPath, string $sTargetEnvironment='production', array $aSelectedExtensions = [], bool $bInstallationOptionalChoicesChecked=true) { $this->sInstallationPath = $sInstallationPath; @@ -42,6 +46,15 @@ class InstallationFileService { $this->bInstallationOptionalChoicesChecked = $bInstallationOptionalChoicesChecked; } + public function Init(): void { + clearstatcache(); + + $this->ProcessDefaultModules(); + $this->ProcessInstallationChoices(); + $this->ProcessExtensionModulesNotSpecifiedInChoices(); + $this->ProcessAutoSelectModules(); + } + public function GetProductionEnv(): RunTimeEnvironment { if (is_null($this->oProductionEnv)){ $this->oProductionEnv = new RunTimeEnvironment(); @@ -57,6 +70,17 @@ class InstallationFileService { return $this->aAfterComputationSelectedExtensions; } + public function SetItopExtensionsMap(ItopExtensionsMap $oItopExtensionsMap): void { + $this->oItopExtensionsMap = $oItopExtensionsMap; + } + + public function GetItopExtensionsMap(): ItopExtensionsMap { + if (is_null($this->oItopExtensionsMap)){ + $this->oItopExtensionsMap = new iTopExtensionsMap($this->sTargetEnvironment, true); + } + return $this->oItopExtensionsMap; + } + public function GetAutoSelectModules(): array { return $this->aAutoSelectModules; } @@ -69,14 +93,6 @@ class InstallationFileService { return $this->aUnSelectedModules; } - public function Init(): void { - clearstatcache(); - - $this->ProcessDefaultModules(); - $this->ProcessInstallationChoices(); - $this->ProcessAutoSelectModules(); - } - public function ProcessInstallationChoices(): void { $oXMLParameters = new XMLParameters($this->sInstallationPath); $aSteps = $oXMLParameters->Get('steps', []); @@ -274,4 +290,76 @@ class InstallationFileService { } } } + + public function CanChooseUnpackageExtension(iTopExtension $oExtension) : bool { + if ($oExtension->sSource === iTopExtension::SOURCE_REMOTE){ + SetupLog::Info("Data Extension can be selected", null, ['extension' => $oExtension->sCode]); + return true; + } + + $bSelectable = $this->bInstallationOptionalChoicesChecked && ($oExtension->sSource === iTopExtension::SOURCE_MANUAL); + if ($bSelectable){ + SetupLog::Info("Manual Extension can be selected", null, ['extension' => $oExtension->sCode]); + } else { + SetupLog::Debug("Manual Extension can NOT be selected", null, ['extension' => $oExtension->sCode]); + } + + return $bSelectable; + } + + public function ProcessExtensionModulesNotSpecifiedInChoices() { + /** @var \iTopExtension $oExtension */ + foreach($this->GetItopExtensionsMap()->GetAllExtensions() as $oExtension) { + if (in_array($oExtension->sCode, $this->aAfterComputationSelectedExtensions)){ + //extension already processed in installation.xml + SetupLog::Info("Extension already processed via installation choices", null, + [ + 'extension' => $oExtension->sCode, + ]) ; + continue; + } + if ($this->CanChooseUnpackageExtension($oExtension)){ + if (($oExtension->bVisible) && (count($oExtension->aMissingDependencies) === 0)) { + $aCurrentModules = []; + $aUnselectableModules = []; + $bIsExtensionSelectable = true; + foreach ($oExtension->aModules as $sModuleId) { + if (array_key_exists($sModuleId, $this->aSelectedModules)) { + //already selected + continue; + } + + if (array_key_exists($sModuleId, $this->aUnSelectedModules)) { + $aUnselectableModules[] = $sModuleId; + + //already unselected + $bIsExtensionSelectable = false; + } else { + $aCurrentModules[$sModuleId] = true; + } + } + + if ($bIsExtensionSelectable) { + SetupLog::Debug("Add modules from unpackaged extension", null, + [ + 'extension' => $oExtension->sCode, + 'source' => $oExtension->sSource, + 'modules to add' => array_keys($aCurrentModules), + ]); + $this->aSelectedModules = array_merge($this->aSelectedModules, $aCurrentModules); + $this->aAfterComputationSelectedExtensions[] = $oExtension->sCode; + } else { + SetupLog::Warning("Unpackaged extension can not be selected due to modules incompatible with installation choices", + null, + [ + 'extension' => $oExtension->sCode, + 'source' => $oExtension->sSource, + 'modules' => array_keys($aCurrentModules), + 'unselectable modules' => $aUnselectableModules, + ]); + } + } + } + } + } } diff --git a/tests/php-unit-tests/unitary-tests/setup/unattended-install/InstallationFileServiceTest.php b/tests/php-unit-tests/unitary-tests/setup/unattended-install/InstallationFileServiceTest.php index 9aefa4237..ee97bd96a 100644 --- a/tests/php-unit-tests/unitary-tests/setup/unattended-install/InstallationFileServiceTest.php +++ b/tests/php-unit-tests/unitary-tests/setup/unattended-install/InstallationFileServiceTest.php @@ -2,9 +2,12 @@ namespace Combodo\iTop\Test\UnitTest\Setup\UnattendedInstall; -use Combodo\iTop\Test\UnitTest\ItopDataTestCase; use Combodo\iTop\Test\UnitTest\ItopTestCase; -use PHPUnit\Framework\TestCase; +use ItopExtensionsMap; +use iTopExtension; +use RunTimeEnvironment; +use InstallationFileService; +use ModuleDiscovery; /** * @group itop-clone-only @@ -13,7 +16,7 @@ class InstallationFileServiceTest extends ItopTestCase { protected function setUp(): void { parent::setUp(); require_once(dirname(__FILE__, 6) . '/setup/unattended-install/InstallationFileService.php'); - \ModuleDiscovery::ResetCache(); + ModuleDiscovery::ResetCache(); } protected function tearDown(): void { @@ -108,9 +111,9 @@ class InstallationFileServiceTest extends ItopTestCase { * @dataProvider ProcessDefaultModulesProvider */ public function testProcessDefaultModules(array $aAllFoundModules, array $aExpectedSelectedModules, array $aExpectedAutoSelectModules) { - $oInstallationFileService = new \InstallationFileService('', 'production', [], true); + $oInstallationFileService = new InstallationFileService('', 'production', [], true); - $oProductionEnv = $this->createMock(\RunTimeEnvironment::class); + $oProductionEnv = $this->createMock(RunTimeEnvironment::class); $oProductionEnv->expects($this->once()) ->method('AnalyzeInstallation') ->willReturn($aAllFoundModules); @@ -141,8 +144,8 @@ class InstallationFileServiceTest extends ItopTestCase { */ public function testProcessInstallationChoices($bInstallationOptionalChoicesChecked) { $sPath = $this->GetInstallationPath(); - $oInstallationFileService = new \InstallationFileService($sPath, 'production', [], $bInstallationOptionalChoicesChecked); - $oProductionEnv = $this->createMock(\RunTimeEnvironment::class); + $oInstallationFileService = new InstallationFileService($sPath, 'production', [], $bInstallationOptionalChoicesChecked); + $oProductionEnv = $this->createMock(RunTimeEnvironment::class); $oProductionEnv->expects($this->never()) ->method('AnalyzeInstallation'); $oInstallationFileService->SetProductionEnv($oProductionEnv); @@ -224,8 +227,8 @@ class InstallationFileServiceTest extends ItopTestCase { */ public function testProcessInstallationChoicesWithItilChoices(array $aSelectedExtensions, bool $bKnownMgtSelected, bool $bCoreMgtSelected) { $sPath = $this->GetInstallationPath(); - $oInstallationFileService = new \InstallationFileService($sPath, 'production', $aSelectedExtensions, false); - $oProductionEnv = $this->createMock(\RunTimeEnvironment::class); + $oInstallationFileService = new InstallationFileService($sPath, 'production', $aSelectedExtensions, false); + $oProductionEnv = $this->createMock(RunTimeEnvironment::class); $oProductionEnv->expects($this->never()) ->method('AnalyzeInstallation'); $oInstallationFileService->SetProductionEnv($oProductionEnv); @@ -299,14 +302,20 @@ class InstallationFileServiceTest extends ItopTestCase { */ public function testGetAllSelectedModules($bInstallationOptionalChoicesChecked=false) { $sPath = $this->GetInstallationPath(); - $oInstallationFileService = new \InstallationFileService($sPath, 'production', [], $bInstallationOptionalChoicesChecked); + $oInstallationFileService = new InstallationFileService($sPath, 'production', [], $bInstallationOptionalChoicesChecked); - $oProductionEnv = $this->createMock(\RunTimeEnvironment::class); + $oProductionEnv = $this->createMock(RunTimeEnvironment::class); $oProductionEnv->expects($this->once()) ->method('AnalyzeInstallation') ->willReturn($this->GetMockListOfFoundModules()); $oInstallationFileService->SetProductionEnv($oProductionEnv); + $oItopExtensionsMap = $this->createMock(ItopExtensionsMap::class); + $oItopExtensionsMap->expects($this->once()) + ->method('GetAllExtensions') + ->willReturn([]); + $oInstallationFileService->SetItopExtensionsMap($oItopExtensionsMap); + $oInstallationFileService->Init(); $aSelectedModules = $oInstallationFileService->GetSelectedModules(); @@ -362,10 +371,10 @@ class InstallationFileServiceTest extends ItopTestCase { $this->ValidateNonItilExtensionComputation($oInstallationFileService, $bInstallationOptionalChoicesChecked); } - private function ValidateNonItilExtensionComputation($oInstallationFileService, bool $bInstallationOptionalChoicesChecked) { + private function ValidateNonItilExtensionComputation($oInstallationFileService, bool $bInstallationOptionalChoicesChecked, array $aAdditionalExtensions=[]) { $aGetAfterComputationSelectedExtensions = $oInstallationFileService->GetAfterComputationSelectedExtensions(); sort($aGetAfterComputationSelectedExtensions); - $aExpectedExtensions = [ + $aExpectedExtensions = array_merge($aAdditionalExtensions, [ 'itop-change-mgmt-simple', 'itop-config-mgmt-core', 'itop-config-mgmt-datacenter', @@ -375,7 +384,7 @@ class InstallationFileServiceTest extends ItopTestCase { 'itop-service-mgmt-enterprise', 'itop-ticket-mgmt-simple-ticket', 'itop-ticket-mgmt-simple-ticket-enhanced-portal', - ]; + ]); if ($bInstallationOptionalChoicesChecked){ $aExpectedExtensions []= "itop-problem-mgmt"; $aExpectedExtensions []= 'itop-kown-error-mgmt'; @@ -465,14 +474,20 @@ class InstallationFileServiceTest extends ItopTestCase { */ public function testGetAllSelectedModules_withItilExtensions(array $aSelectedExtensions, bool $bKnownMgtSelected, bool $bCoreMgtSelected) { $sPath = $this->GetInstallationPath(); - $oInstallationFileService = new \InstallationFileService($sPath, 'production', $aSelectedExtensions); + $oInstallationFileService = new InstallationFileService($sPath, 'production', $aSelectedExtensions); - $oProductionEnv = $this->createMock(\RunTimeEnvironment::class); + $oProductionEnv = $this->createMock(RunTimeEnvironment::class); $oProductionEnv->expects($this->once()) ->method('AnalyzeInstallation') ->willReturn($this->GetMockListOfFoundModules()); $oInstallationFileService->SetProductionEnv($oProductionEnv); + $oItopExtensionsMap = $this->createMock(ItopExtensionsMap::class); + $oItopExtensionsMap->expects($this->once()) + ->method('GetAllExtensions') + ->willReturn([]); + $oInstallationFileService->SetItopExtensionsMap($oItopExtensionsMap); + $oInstallationFileService->Init(); $aSelectedModules = $oInstallationFileService->GetSelectedModules(); @@ -564,4 +579,228 @@ class InstallationFileServiceTest extends ItopTestCase { @rmdir($sFromDir); } + + private function CreateItopExtension(string $sSource, string $sCode, array $aModules, array $aMissingDependencies, bool $bIsVisible) : iTopExtension{ + $oExtension = new iTopExtension(); + $oExtension->sCode = $sCode; + $oExtension->sSource = $sSource; + $oExtension->aModules = $aModules; + $oExtension->aMissingDependencies = $aMissingDependencies; + $oExtension->bVisible = $bIsVisible; + return $oExtension; + } + + public function CanChooseUnpackageExtensionProvider() { + return [ + 'extension in SOURCE_REMOTE' => [ + 'sCode' => "extension-from-designer", + 'bInstallationOptionalChoicesChecked' => false, + 'sSource' => 'data', + 'bExpectedRes' => true + ], + 'extension in SOURCE_WIZARD' => [ + 'sCode' => 'extension-from-package', + 'bInstallationOptionalChoicesChecked' => true, + 'sSource' => 'datamodels', + 'bExpectedRes' => false + ], + 'extension in SOURCE_MANUAL + optional OK' => [ + 'sCode' => 'extension-from-package', + 'bInstallationOptionalChoicesChecked' => true, + 'sSource' => 'extensions', + 'bExpectedRes' => true + ], + 'extension in SOURCE_MANUAL + optional NOT OK' => [ + 'sCode' => 'extension-from-package', + 'bInstallationOptionalChoicesChecked' => false, + 'sSource' => 'extensions', + 'bExpectedRes' => false + ], + ]; + } + + /** + * @dataProvider CanChooseUnpackageExtensionProvider + */ + public function testCanChooseUnpackageExtension(string $sCode, bool $bInstallationOptionalChoicesChecked, string $sSource, bool $bExpectedRes) { + $sPath = $this->GetInstallationPath(); + $oInstallationFileService = new InstallationFileService($sPath, 'production', [], $bInstallationOptionalChoicesChecked); + + $oItopExtension = $this->CreateItopExtension($sSource, $sCode, [], [], true); + $this->assertEquals($bExpectedRes, $oInstallationFileService->CanChooseUnpackageExtension($oItopExtension)); + } + + public function ProcessExtensionModulesNotSpecifiedInChoicesProvider() { + return [ + 'extensions to install OK' => [ + 'aExtensionData' => [ + 'extension1' => [ + //'itop-request-mgmt-itil', //unselected + 'combodo-monitoring', + 'itop-config-mgmt', //already selected + ], + 'extension2' => [ + //'itop-incident-mgmt-itil', //unselected + 'combodo-monitoring2', + 'itop-attachments', //already selected + ] + ], + 'bExtensionCanBeChoosen' => true, + 'aMissingDependencies' => [], + 'bIsVisible' => true, + 'bExpectedAdditionalExtensions' => [ + 'extension1', 'extension2' + ], + 'bExpectedAdditionalModules' => [ + 'combodo-monitoring', 'combodo-monitoring2' + ] + ], + 'extensions to install cannot be choose,' => [ + 'aExtensionData' => [ + 'extension1' => [ + 'combodo-monitoring', + ], + 'extension2' => [ + 'combodo-monitoring2', + ] + ], + 'bExtensionCanBeChoosen' => false, + 'aMissingDependencies' => [], + 'bIsVisible' => true, + 'bExpectedAdditionalExtensions' => [], + 'bExpectedAdditionalModules' => [] + ], + 'extensions to install not visible' => [ + 'aExtensionData' => [ + 'extension1' => [ + 'combodo-monitoring', + ], + 'extension2' => [ + 'combodo-monitoring2', + ] + ], + 'bExtensionCanBeChoosen' => true, + 'aMissingDependencies' => [], + 'bIsVisible' => false, + 'bExpectedAdditionalExtensions' => [], + 'bExpectedAdditionalModules' => [] + ], + 'extensions to install with missing dependencies' => [ + 'aExtensionData' => [ + 'extension1' => [ + 'combodo-monitoring', + ], + 'extension2' => [ + 'combodo-monitoring2', + ] + ], + 'bExtensionCanBeChoosen' => true, + 'aMissingDependencies' => ['missing-module'], + 'bIsVisible' => true, + 'bExpectedAdditionalExtensions' => [], + 'bExpectedAdditionalModules' => [] + ], + 'extensions to install with unselectable ITIL module' => [ + 'aExtensionData' => [ + 'extension1' => [ + 'itop-request-mgmt-itil', //unselected + 'combodo-monitoring', + ], + 'extension2' => [ + 'itop-incident-mgmt-itil', //unselected + 'combodo-monitoring2', + ] + ], + 'bExtensionCanBeChoosen' => true, + 'aMissingDependencies' => [], + 'bIsVisible' => true, + 'bExpectedAdditionalExtensions' => [], + 'bExpectedAdditionalModules' => [] + ], + 'extensions already processed' => [ + 'aExtensionData' => [ + 'itop-config-mgmt-core' => [ + 'itop-config-mgmt', //already selected + ], + ], + 'bExtensionCanBeChoosen' => true, + 'aMissingDependencies' => [], + 'bIsVisible' => true, + 'bExpectedAdditionalExtensions' => [ + ], + 'bExpectedAdditionalModules' => [ + ] + ], + ]; + } + + /** + * @dataProvider ProcessExtensionModulesNotSpecifiedInChoicesProvider + */ + public function testProcessExtensionModulesNotSpecifiedInChoices(array $aExtensionData, bool $bExtensionCanBeChoosen, + array $aMissingDependencies, bool $bIsVisible, array $bExpectedAdditionalExtensions, array $bExpectedAdditionalModules) { + $sPath = $this->GetInstallationPath(); + $oInstallationFileService = new InstallationFileService($sPath, 'production', [], true); + + $oProductionEnv = $this->createMock(RunTimeEnvironment::class); + $oProductionEnv->expects($this->once()) + ->method('AnalyzeInstallation') + ->willReturn($this->GetMockListOfFoundModules()); + $oInstallationFileService->SetProductionEnv($oProductionEnv); + + $oItopExtensionsMap = $this->createMock(ItopExtensionsMap::class); + $aItopExtensionMap = []; + + $sSource = $bExtensionCanBeChoosen ? iTopExtension::SOURCE_REMOTE : iTopExtension::SOURCE_WIZARD; + foreach ($aExtensionData as $sExtensionCode => $aModules){ + $aItopExtensionMap[]= $this->CreateItopExtension($sSource, $sExtensionCode, $aModules, $aMissingDependencies, $bIsVisible); + } + $oItopExtensionsMap->expects($this->once()) + ->method('GetAllExtensions') + ->willReturn($aItopExtensionMap); + $oInstallationFileService->SetItopExtensionsMap($oItopExtensionsMap); + + $oInstallationFileService->Init(); + + $aSelectedModules = array_keys($oInstallationFileService->GetSelectedModules()); + sort($aSelectedModules); + $aExpectedInstallationModules = array_merge($bExpectedAdditionalModules, [ + "itop-config-mgmt", + "itop-attachments", + "itop-profiles-itil", + "itop-welcome-itil", + "itop-tickets", + "itop-files-information", + "combodo-db-tools", + "itop-core-update", + "itop-hub-connector", + "itop-oauth-client", + "itop-datacenter-mgmt", + "itop-endusers-devices", + "itop-storage-mgmt", + "itop-virtualization-mgmt", + "itop-service-mgmt", + "itop-request-mgmt", + "itop-portal", + "itop-portal-base", + "itop-change-mgmt", + "itop-problem-mgmt", + "itop-knownerror-mgmt", + 'authent-cas', + 'authent-external', + 'authent-ldap', + 'authent-local', + 'itop-backup', + 'itop-config', + 'itop-sla-computation', + 'itop-bridge-virtualization-storage', + ]); + sort($aExpectedInstallationModules); + + $this->assertEquals($aExpectedInstallationModules, $aSelectedModules); + + $this->ValidateNonItilExtensionComputation($oInstallationFileService, true, $bExpectedAdditionalExtensions); + } + + } From f4e791734fdcdaf45122e2053a9751b2a681839e Mon Sep 17 00:00:00 2001 From: odain Date: Fri, 12 Apr 2024 14:49:20 +0200 Subject: [PATCH 4/6] =?UTF-8?q?N=C2=B07407=20-=20remove=20phpunit=20annota?= =?UTF-8?q?tion?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../InstallationFileServiceTest.php | 806 ------------------ 1 file changed, 806 deletions(-) diff --git a/tests/php-unit-tests/unitary-tests/setup/unattended-install/InstallationFileServiceTest.php b/tests/php-unit-tests/unitary-tests/setup/unattended-install/InstallationFileServiceTest.php index ee97bd96a..e69de29bb 100644 --- a/tests/php-unit-tests/unitary-tests/setup/unattended-install/InstallationFileServiceTest.php +++ b/tests/php-unit-tests/unitary-tests/setup/unattended-install/InstallationFileServiceTest.php @@ -1,806 +0,0 @@ -RecurseMoveDir(APPROOT."data/production-modules/$sModuleId", APPROOT . "datamodels/2.x/$sModuleId"); - } - - private function GetInstallationPath() : string { - return realpath(__DIR__ . '/resources/installation.xml'); - } - - private function GetModuleData($sCategory, bool $bIsVisible, bool $bIsAutoSelect, bool $bProductionModulesInRootDir=false) : array { - $sRootDir = $bProductionModulesInRootDir ? APPROOT.'data/production-modules/' : ''; - - $aModuleData = [ - 'category' => $sCategory, - 'visible' => $bIsVisible, - 'root_dir' => $sRootDir, - ]; - - if ($bIsAutoSelect){ - $aModuleData['auto_select'] = true; - } - - return $aModuleData; - } - - public function ProcessDefaultModulesProvider() { - parent::setUp(); - return [ - 'root module' => [ - 'aAllFoundModules' => [ - '_Root_' => $this->GetModuleData('authentication', false, false, true), - ], - 'aExpectedSelectedModules' => [], - 'aExpectedAutoSelectModules' => [], - ], - 'auto-select root module' => [ - 'aAllFoundModules' => [ - '_Root_' => $this->GetModuleData('authentication', false, true, true), - ], - 'aExpectedSelectedModules' => [], - 'aExpectedAutoSelectModules' => [], - ], - 'autoselect module only' => [ - 'aAllFoundModules' => [ - 'autoselect-only' => $this->GetModuleData('mycategory', true, true), - ], - 'aExpectedSelectedModules' => [], - 'aExpectedAutoSelectModules' => ['autoselect-only'], - ], - 'autoselect/invisible module' => [ - 'aAllFoundModules' => [ - 'autoselect-only' => $this->GetModuleData('mycategory', false, true), - ], - 'aExpectedSelectedModules' => [], - 'aExpectedAutoSelectModules' => ['autoselect-only'], - ], - 'autoselect/invisible/in-root-dir module' => [ - 'aAllFoundModules' => [ - 'autoselect-only' => $this->GetModuleData('mycategory', false, true , true), - ], - 'aExpectedSelectedModules' => [], - 'aExpectedAutoSelectModules' => ['autoselect-only'], - ], - 'visible/authent module' => [ - 'aAllFoundModules' => [ - 'authent-module' => $this->GetModuleData('authentication', true, false , false), - ], - 'aExpectedSelectedModules' => ['authent-module'], - 'aExpectedAutoSelectModules' => [], - ], - 'invisible module' => [ - 'aAllFoundModules' => [ - 'visible-module' => $this->GetModuleData('mycategory', false, false , false), - ], - 'aExpectedSelectedModules' => ['visible-module'], - 'aExpectedAutoSelectModules' => [], - ], - 'in-root-dir module' => [ - 'aAllFoundModules' => [ - 'in-root-dir-module' => $this->GetModuleData('mycategory', true, false , true), - ], - 'aExpectedSelectedModules' => ['in-root-dir-module'], - 'aExpectedAutoSelectModules' => [], - ], - ]; - } - /** - * @dataProvider ProcessDefaultModulesProvider - */ - public function testProcessDefaultModules(array $aAllFoundModules, array $aExpectedSelectedModules, array $aExpectedAutoSelectModules) { - $oInstallationFileService = new InstallationFileService('', 'production', [], true); - - $oProductionEnv = $this->createMock(RunTimeEnvironment::class); - $oProductionEnv->expects($this->once()) - ->method('AnalyzeInstallation') - ->willReturn($aAllFoundModules); - - $oInstallationFileService->SetProductionEnv($oProductionEnv); - $oInstallationFileService->ProcessDefaultModules(); - - sort($aExpectedSelectedModules); - $aModules = array_keys($oInstallationFileService->GetSelectedModules()); - sort($aModules); - - $this->assertEquals($aExpectedSelectedModules, $aModules); - - $aAutoSelectModules = array_keys($oInstallationFileService->GetAutoSelectModules()); - sort($aAutoSelectModules); - $this->assertEquals($aExpectedAutoSelectModules, $aAutoSelectModules); - } - - public function ProcessInstallationChoicesProvider() { - return [ - 'all checked' => [ true ], - 'only defaut + mandatory' => [ false ], - ]; - } - - /** - * @dataProvider ProcessInstallationChoicesProvider - */ - public function testProcessInstallationChoices($bInstallationOptionalChoicesChecked) { - $sPath = $this->GetInstallationPath(); - $oInstallationFileService = new InstallationFileService($sPath, 'production', [], $bInstallationOptionalChoicesChecked); - $oProductionEnv = $this->createMock(RunTimeEnvironment::class); - $oProductionEnv->expects($this->never()) - ->method('AnalyzeInstallation'); - $oInstallationFileService->SetProductionEnv($oProductionEnv); - - $oInstallationFileService->ProcessInstallationChoices(); - $aExpectedModules = [ - "itop-config-mgmt", - "itop-attachments", - "itop-profiles-itil", - "itop-welcome-itil", - "itop-tickets", - "itop-files-information", - "combodo-db-tools", - "itop-core-update", - "itop-hub-connector", - "itop-oauth-client", - "itop-datacenter-mgmt", - "itop-endusers-devices", - "itop-storage-mgmt", - "itop-virtualization-mgmt", - "itop-service-mgmt", - "itop-request-mgmt", - "itop-portal", - "itop-portal-base", - "itop-change-mgmt", - ]; - - $aExpectedUnselectedModules = [ - 'itop-change-mgmt-itil', - 'itop-incident-mgmt-itil', - 'itop-request-mgmt-itil', - 'itop-service-mgmt-provider', - ]; - - if ($bInstallationOptionalChoicesChecked){ - $aExpectedModules []= "itop-problem-mgmt"; - $aExpectedModules []= "itop-knownerror-mgmt"; - } else { - $aExpectedUnselectedModules []= "itop-problem-mgmt"; - $aExpectedUnselectedModules []= "itop-knownerror-mgmt"; - } - - sort($aExpectedModules); - $aModules = array_keys($oInstallationFileService->GetSelectedModules()); - sort($aModules); - - $this->assertEquals($aExpectedModules, $aModules); - - $aUnselectedModules = array_keys($oInstallationFileService->GetUnSelectedModules()); - sort($aExpectedUnselectedModules); - sort($aUnselectedModules); - $this->assertEquals($aExpectedUnselectedModules, $aUnselectedModules); - - $aGetAfterComputationSelectedExtensions = $oInstallationFileService->GetAfterComputationSelectedExtensions(); - sort($aGetAfterComputationSelectedExtensions); - $aExpectedExtensions = [ - 'itop-change-mgmt-simple', - 'itop-config-mgmt-core', - 'itop-config-mgmt-datacenter', - 'itop-config-mgmt-end-user', - 'itop-config-mgmt-storage', - 'itop-config-mgmt-virtualization', - 'itop-service-mgmt-enterprise', - 'itop-ticket-mgmt-simple-ticket', - 'itop-ticket-mgmt-simple-ticket-enhanced-portal', - ]; - if ($bInstallationOptionalChoicesChecked){ - $aExpectedExtensions []= "itop-problem-mgmt"; - $aExpectedExtensions []= 'itop-kown-error-mgmt'; - } - sort($aExpectedExtensions); - $this->assertEquals($aExpectedExtensions, $aGetAfterComputationSelectedExtensions); - - $this->ValidateNonItilExtensionComputation($oInstallationFileService, $bInstallationOptionalChoicesChecked); - } - - /** - * @dataProvider ItilExtensionProvider - */ - public function testProcessInstallationChoicesWithItilChoices(array $aSelectedExtensions, bool $bKnownMgtSelected, bool $bCoreMgtSelected) { - $sPath = $this->GetInstallationPath(); - $oInstallationFileService = new InstallationFileService($sPath, 'production', $aSelectedExtensions, false); - $oProductionEnv = $this->createMock(RunTimeEnvironment::class); - $oProductionEnv->expects($this->never()) - ->method('AnalyzeInstallation'); - $oInstallationFileService->SetProductionEnv($oProductionEnv); - - $oInstallationFileService->ProcessInstallationChoices(); - - $aExpectedInstallationModules = [ - "itop-config-mgmt", - "itop-attachments", - "itop-profiles-itil", - "itop-welcome-itil", - "itop-tickets", - "itop-files-information", - "combodo-db-tools", - "itop-core-update", - "itop-hub-connector", - "itop-oauth-client", - "itop-datacenter-mgmt", - "itop-endusers-devices", - "itop-storage-mgmt", - "itop-virtualization-mgmt", - "itop-service-mgmt", - "itop-request-mgmt-itil", - "itop-incident-mgmt-itil", - "itop-portal", - "itop-portal-base", - "itop-change-mgmt-itil", - ]; - if ($bKnownMgtSelected){ - $aExpectedInstallationModules []= "itop-knownerror-mgmt"; - } - - sort($aExpectedInstallationModules); - $aModules = array_keys($oInstallationFileService->GetSelectedModules()); - sort($aModules); - - $this->assertEquals($aExpectedInstallationModules, $aModules); - - $aExpectedUnselectedModules = [ - 0 => 'itop-change-mgmt', - 1 => 'itop-problem-mgmt', - 2 => 'itop-request-mgmt', - 3 => 'itop-service-mgmt-provider', - ]; - if (!$bKnownMgtSelected){ - $aExpectedUnselectedModules[]='itop-knownerror-mgmt'; - } - $aUnselectedModules = array_keys($oInstallationFileService->GetUnSelectedModules()); - sort($aExpectedUnselectedModules); - sort($aUnselectedModules); - $this->assertEquals($aExpectedUnselectedModules, $aUnselectedModules); - - $this->ValidateItilExtensionComputation($oInstallationFileService, $bKnownMgtSelected, $bCoreMgtSelected); - } - - public function GetDefaultModulesProvider() { - return [ - 'check all possible modules' => [true], - 'only minimum defaul/mandatory from installation.xml' => [false], - ]; - } - - private function GetMockListOfFoundModules() : array { - $sJsonContent = file_get_contents(realpath(__DIR__ . '/resources/AnalyzeInstallation.json')); - $sJsonContent = str_replace('ROOTDIR_TOREPLACE', APPROOT, $sJsonContent); - return json_decode($sJsonContent, true); - } - - /** - * @dataProvider GetDefaultModulesProvider - */ - public function testGetAllSelectedModules($bInstallationOptionalChoicesChecked=false) { - $sPath = $this->GetInstallationPath(); - $oInstallationFileService = new InstallationFileService($sPath, 'production', [], $bInstallationOptionalChoicesChecked); - - $oProductionEnv = $this->createMock(RunTimeEnvironment::class); - $oProductionEnv->expects($this->once()) - ->method('AnalyzeInstallation') - ->willReturn($this->GetMockListOfFoundModules()); - $oInstallationFileService->SetProductionEnv($oProductionEnv); - - $oItopExtensionsMap = $this->createMock(ItopExtensionsMap::class); - $oItopExtensionsMap->expects($this->once()) - ->method('GetAllExtensions') - ->willReturn([]); - $oInstallationFileService->SetItopExtensionsMap($oItopExtensionsMap); - - $oInstallationFileService->Init(); - - $aSelectedModules = $oInstallationFileService->GetSelectedModules(); - $aExpectedInstallationModules = [ - "itop-config-mgmt", - "itop-attachments", - "itop-profiles-itil", - "itop-welcome-itil", - "itop-tickets", - "itop-files-information", - "combodo-db-tools", - "itop-core-update", - "itop-hub-connector", - "itop-oauth-client", - "itop-datacenter-mgmt", - "itop-endusers-devices", - "itop-storage-mgmt", - "itop-virtualization-mgmt", - "itop-service-mgmt", - "itop-request-mgmt", - "itop-portal", - "itop-portal-base", - "itop-change-mgmt", - ]; - if ($bInstallationOptionalChoicesChecked){ - $aExpectedInstallationModules []= "itop-problem-mgmt"; - $aExpectedInstallationModules []= "itop-knownerror-mgmt"; - } - - $aExpectedAuthenticationModules = [ - 'authent-cas', - 'authent-external', - 'authent-ldap', - 'authent-local', - ]; - - $aUnvisibleModules = [ - 'itop-backup', - 'itop-config', - 'itop-sla-computation', - ]; - - $aAutoSelectedModules = [ - 'itop-bridge-virtualization-storage', - ]; - - $this->checkModuleList("installation.xml choices", $aExpectedInstallationModules, $aSelectedModules); - $this->checkModuleList("authentication category", $aExpectedAuthenticationModules, $aSelectedModules); - $this->checkModuleList("unvisible", $aUnvisibleModules, $aSelectedModules); - $this->checkModuleList("auto-select", $aAutoSelectedModules, $aSelectedModules); - $this->assertEquals([], $aSelectedModules, "there should be no more modules remaining apart from below lists"); - - $this->ValidateNonItilExtensionComputation($oInstallationFileService, $bInstallationOptionalChoicesChecked); - } - - private function ValidateNonItilExtensionComputation($oInstallationFileService, bool $bInstallationOptionalChoicesChecked, array $aAdditionalExtensions=[]) { - $aGetAfterComputationSelectedExtensions = $oInstallationFileService->GetAfterComputationSelectedExtensions(); - sort($aGetAfterComputationSelectedExtensions); - $aExpectedExtensions = array_merge($aAdditionalExtensions, [ - 'itop-change-mgmt-simple', - 'itop-config-mgmt-core', - 'itop-config-mgmt-datacenter', - 'itop-config-mgmt-end-user', - 'itop-config-mgmt-storage', - 'itop-config-mgmt-virtualization', - 'itop-service-mgmt-enterprise', - 'itop-ticket-mgmt-simple-ticket', - 'itop-ticket-mgmt-simple-ticket-enhanced-portal', - ]); - if ($bInstallationOptionalChoicesChecked){ - $aExpectedExtensions []= "itop-problem-mgmt"; - $aExpectedExtensions []= 'itop-kown-error-mgmt'; - } - sort($aExpectedExtensions); - $this->assertEquals($aExpectedExtensions, $aGetAfterComputationSelectedExtensions); - } - - private function ValidateItilExtensionComputation($oInstallationFileService, bool $bKnownMgtSelected, bool $bCoreMgtSelected) { - $aGetAfterComputationSelectedExtensions = $oInstallationFileService->GetAfterComputationSelectedExtensions(); - sort($aGetAfterComputationSelectedExtensions); - $aExpectedExtensions = [ - 'itop-change-mgmt-itil', - 'itop-config-mgmt-datacenter', - 'itop-config-mgmt-end-user', - 'itop-config-mgmt-storage', - 'itop-config-mgmt-virtualization', - 'itop-service-mgmt-enterprise', - 'itop-ticket-mgmt-itil', - 'itop-ticket-mgmt-itil-enhanced-portal', - 'itop-ticket-mgmt-itil-incident', - 'itop-ticket-mgmt-itil-user-request', - ]; - if ($bCoreMgtSelected){ - $aExpectedExtensions []= 'itop-config-mgmt-core'; - } - if ($bKnownMgtSelected){ - $aExpectedExtensions []= 'itop-kown-error-mgmt'; - } - sort($aExpectedExtensions); - $this->assertEquals($aExpectedExtensions, $aGetAfterComputationSelectedExtensions); - } - - private function GetSelectedItilExtensions(bool $coreExtensionIncluded, bool $bKnownMgtIncluded) : array { - $aExtensions = [ - 'itop-config-mgmt-datacenter', - 'itop-config-mgmt-end-user', - 'itop-config-mgmt-storage', - 'itop-config-mgmt-virtualization', - 'itop-service-mgmt-enterprise', - 'itop-ticket-mgmt-itil', - 'itop-ticket-mgmt-itil-user-request', - 'itop-ticket-mgmt-itil-incident', - 'itop-ticket-mgmt-itil-enhanced-portal', - 'itop-change-mgmt-itil', - ]; - - if ($coreExtensionIncluded){ - $aExtensions[]= 'itop-config-mgmt-core'; - } - - if ($bKnownMgtIncluded){ - $aExtensions[]= 'itop-kown-error-mgmt'; - } - - return $aExtensions; - - } - - public function ItilExtensionProvider() { - return [ - 'all itil extensions + INCLUDING known-error-mgt' => [ - 'aSelectedExtensions' => $this->GetSelectedItilExtensions(true, true), - 'bKnownMgtSelected' => true, - 'bCoreMgtSelected' => true, - ], - 'all itil extensions WITHOUT known-error-mgt' => [ - 'aSelectedExtensions' => $this->GetSelectedItilExtensions(true, false), - 'bKnownMgtSelected' => false, - 'bCoreMgtSelected' => true, - ], - 'all itil extensions WITHOUT core mandatory ones + INCLUDING known-error-mgt' => [ - 'aSelectedExtensions' => $this->GetSelectedItilExtensions(false, true), - 'bKnownMgtSelected' => true, - 'bCoreMgtSelected' => false, - ], - 'all itil extensions WITHOUT core mandatory ones and WITHOUT known-error-mgt' => [ - 'aSelectedExtensions' => $this->GetSelectedItilExtensions(false, false), - 'bKnownMgtSelected' => false, - 'bCoreMgtSelected' => false, - ], - ]; - } - - /** - * @dataProvider ItilExtensionProvider - */ - public function testGetAllSelectedModules_withItilExtensions(array $aSelectedExtensions, bool $bKnownMgtSelected, bool $bCoreMgtSelected) { - $sPath = $this->GetInstallationPath(); - $oInstallationFileService = new InstallationFileService($sPath, 'production', $aSelectedExtensions); - - $oProductionEnv = $this->createMock(RunTimeEnvironment::class); - $oProductionEnv->expects($this->once()) - ->method('AnalyzeInstallation') - ->willReturn($this->GetMockListOfFoundModules()); - $oInstallationFileService->SetProductionEnv($oProductionEnv); - - $oItopExtensionsMap = $this->createMock(ItopExtensionsMap::class); - $oItopExtensionsMap->expects($this->once()) - ->method('GetAllExtensions') - ->willReturn([]); - $oInstallationFileService->SetItopExtensionsMap($oItopExtensionsMap); - - $oInstallationFileService->Init(); - - $aSelectedModules = $oInstallationFileService->GetSelectedModules(); - $aExpectedInstallationModules = [ - "itop-config-mgmt", - "itop-attachments", - "itop-profiles-itil", - "itop-welcome-itil", - "itop-tickets", - "itop-files-information", - "combodo-db-tools", - "itop-core-update", - "itop-hub-connector", - "itop-oauth-client", - "itop-datacenter-mgmt", - "itop-endusers-devices", - "itop-storage-mgmt", - "itop-virtualization-mgmt", - "itop-service-mgmt", - "itop-request-mgmt-itil", - "itop-incident-mgmt-itil", - "itop-portal", - "itop-portal-base", - "itop-change-mgmt-itil", - "itop-full-itil", - ]; - if ($bKnownMgtSelected){ - $aExpectedInstallationModules []= "itop-knownerror-mgmt"; - } - - $aExpectedAuthenticationModules = [ - 'authent-cas', - 'authent-external', - 'authent-ldap', - 'authent-local', - ]; - - $aUnvisibleModules = [ - 'itop-backup', - 'itop-config', - 'itop-sla-computation', - ]; - - $aAutoSelectedModules = [ - 'itop-bridge-virtualization-storage', - ]; - - $this->checkModuleList("installation.xml choices", $aExpectedInstallationModules, $aSelectedModules); - $this->checkModuleList("authentication category", $aExpectedAuthenticationModules, $aSelectedModules); - $this->checkModuleList("unvisible", $aUnvisibleModules, $aSelectedModules); - $this->checkModuleList("auto-select", $aAutoSelectedModules, $aSelectedModules); - $this->assertEquals([], $aSelectedModules, "there should be no more modules remaining apart from below lists"); - - $this->ValidateItilExtensionComputation($oInstallationFileService, $bKnownMgtSelected, $bCoreMgtSelected); - } - - private function checkModuleList(string $sModuleCategory, array $aExpectedModuleList, array &$aSelectedModules) { - $aMissingModules = []; - - foreach ($aExpectedModuleList as $sModuleId){ - if (! array_key_exists($sModuleId, $aSelectedModules)){ - $aMissingModules[]=$sModuleId; - } else { - unset($aSelectedModules[$sModuleId]); - } - } - - $this->assertEquals([], $aMissingModules, "$sModuleCategory modules are missing"); - - } - - private function RecurseMoveDir($sFromDir, $sToDir) { - if (! is_dir($sFromDir)){ - return; - } - - if (! is_dir($sToDir)){ - @mkdir($sToDir); - } - - foreach (glob("$sFromDir/*") as $sPath){ - $sToPath = $sToDir.'/'.basename($sPath); - if (is_file($sPath)){ - @rename($sPath, $sToPath); - } else { - $this->RecurseMoveDir($sPath, $sToPath); - } - } - - @rmdir($sFromDir); - } - - private function CreateItopExtension(string $sSource, string $sCode, array $aModules, array $aMissingDependencies, bool $bIsVisible) : iTopExtension{ - $oExtension = new iTopExtension(); - $oExtension->sCode = $sCode; - $oExtension->sSource = $sSource; - $oExtension->aModules = $aModules; - $oExtension->aMissingDependencies = $aMissingDependencies; - $oExtension->bVisible = $bIsVisible; - return $oExtension; - } - - public function CanChooseUnpackageExtensionProvider() { - return [ - 'extension in SOURCE_REMOTE' => [ - 'sCode' => "extension-from-designer", - 'bInstallationOptionalChoicesChecked' => false, - 'sSource' => 'data', - 'bExpectedRes' => true - ], - 'extension in SOURCE_WIZARD' => [ - 'sCode' => 'extension-from-package', - 'bInstallationOptionalChoicesChecked' => true, - 'sSource' => 'datamodels', - 'bExpectedRes' => false - ], - 'extension in SOURCE_MANUAL + optional OK' => [ - 'sCode' => 'extension-from-package', - 'bInstallationOptionalChoicesChecked' => true, - 'sSource' => 'extensions', - 'bExpectedRes' => true - ], - 'extension in SOURCE_MANUAL + optional NOT OK' => [ - 'sCode' => 'extension-from-package', - 'bInstallationOptionalChoicesChecked' => false, - 'sSource' => 'extensions', - 'bExpectedRes' => false - ], - ]; - } - - /** - * @dataProvider CanChooseUnpackageExtensionProvider - */ - public function testCanChooseUnpackageExtension(string $sCode, bool $bInstallationOptionalChoicesChecked, string $sSource, bool $bExpectedRes) { - $sPath = $this->GetInstallationPath(); - $oInstallationFileService = new InstallationFileService($sPath, 'production', [], $bInstallationOptionalChoicesChecked); - - $oItopExtension = $this->CreateItopExtension($sSource, $sCode, [], [], true); - $this->assertEquals($bExpectedRes, $oInstallationFileService->CanChooseUnpackageExtension($oItopExtension)); - } - - public function ProcessExtensionModulesNotSpecifiedInChoicesProvider() { - return [ - 'extensions to install OK' => [ - 'aExtensionData' => [ - 'extension1' => [ - //'itop-request-mgmt-itil', //unselected - 'combodo-monitoring', - 'itop-config-mgmt', //already selected - ], - 'extension2' => [ - //'itop-incident-mgmt-itil', //unselected - 'combodo-monitoring2', - 'itop-attachments', //already selected - ] - ], - 'bExtensionCanBeChoosen' => true, - 'aMissingDependencies' => [], - 'bIsVisible' => true, - 'bExpectedAdditionalExtensions' => [ - 'extension1', 'extension2' - ], - 'bExpectedAdditionalModules' => [ - 'combodo-monitoring', 'combodo-monitoring2' - ] - ], - 'extensions to install cannot be choose,' => [ - 'aExtensionData' => [ - 'extension1' => [ - 'combodo-monitoring', - ], - 'extension2' => [ - 'combodo-monitoring2', - ] - ], - 'bExtensionCanBeChoosen' => false, - 'aMissingDependencies' => [], - 'bIsVisible' => true, - 'bExpectedAdditionalExtensions' => [], - 'bExpectedAdditionalModules' => [] - ], - 'extensions to install not visible' => [ - 'aExtensionData' => [ - 'extension1' => [ - 'combodo-monitoring', - ], - 'extension2' => [ - 'combodo-monitoring2', - ] - ], - 'bExtensionCanBeChoosen' => true, - 'aMissingDependencies' => [], - 'bIsVisible' => false, - 'bExpectedAdditionalExtensions' => [], - 'bExpectedAdditionalModules' => [] - ], - 'extensions to install with missing dependencies' => [ - 'aExtensionData' => [ - 'extension1' => [ - 'combodo-monitoring', - ], - 'extension2' => [ - 'combodo-monitoring2', - ] - ], - 'bExtensionCanBeChoosen' => true, - 'aMissingDependencies' => ['missing-module'], - 'bIsVisible' => true, - 'bExpectedAdditionalExtensions' => [], - 'bExpectedAdditionalModules' => [] - ], - 'extensions to install with unselectable ITIL module' => [ - 'aExtensionData' => [ - 'extension1' => [ - 'itop-request-mgmt-itil', //unselected - 'combodo-monitoring', - ], - 'extension2' => [ - 'itop-incident-mgmt-itil', //unselected - 'combodo-monitoring2', - ] - ], - 'bExtensionCanBeChoosen' => true, - 'aMissingDependencies' => [], - 'bIsVisible' => true, - 'bExpectedAdditionalExtensions' => [], - 'bExpectedAdditionalModules' => [] - ], - 'extensions already processed' => [ - 'aExtensionData' => [ - 'itop-config-mgmt-core' => [ - 'itop-config-mgmt', //already selected - ], - ], - 'bExtensionCanBeChoosen' => true, - 'aMissingDependencies' => [], - 'bIsVisible' => true, - 'bExpectedAdditionalExtensions' => [ - ], - 'bExpectedAdditionalModules' => [ - ] - ], - ]; - } - - /** - * @dataProvider ProcessExtensionModulesNotSpecifiedInChoicesProvider - */ - public function testProcessExtensionModulesNotSpecifiedInChoices(array $aExtensionData, bool $bExtensionCanBeChoosen, - array $aMissingDependencies, bool $bIsVisible, array $bExpectedAdditionalExtensions, array $bExpectedAdditionalModules) { - $sPath = $this->GetInstallationPath(); - $oInstallationFileService = new InstallationFileService($sPath, 'production', [], true); - - $oProductionEnv = $this->createMock(RunTimeEnvironment::class); - $oProductionEnv->expects($this->once()) - ->method('AnalyzeInstallation') - ->willReturn($this->GetMockListOfFoundModules()); - $oInstallationFileService->SetProductionEnv($oProductionEnv); - - $oItopExtensionsMap = $this->createMock(ItopExtensionsMap::class); - $aItopExtensionMap = []; - - $sSource = $bExtensionCanBeChoosen ? iTopExtension::SOURCE_REMOTE : iTopExtension::SOURCE_WIZARD; - foreach ($aExtensionData as $sExtensionCode => $aModules){ - $aItopExtensionMap[]= $this->CreateItopExtension($sSource, $sExtensionCode, $aModules, $aMissingDependencies, $bIsVisible); - } - $oItopExtensionsMap->expects($this->once()) - ->method('GetAllExtensions') - ->willReturn($aItopExtensionMap); - $oInstallationFileService->SetItopExtensionsMap($oItopExtensionsMap); - - $oInstallationFileService->Init(); - - $aSelectedModules = array_keys($oInstallationFileService->GetSelectedModules()); - sort($aSelectedModules); - $aExpectedInstallationModules = array_merge($bExpectedAdditionalModules, [ - "itop-config-mgmt", - "itop-attachments", - "itop-profiles-itil", - "itop-welcome-itil", - "itop-tickets", - "itop-files-information", - "combodo-db-tools", - "itop-core-update", - "itop-hub-connector", - "itop-oauth-client", - "itop-datacenter-mgmt", - "itop-endusers-devices", - "itop-storage-mgmt", - "itop-virtualization-mgmt", - "itop-service-mgmt", - "itop-request-mgmt", - "itop-portal", - "itop-portal-base", - "itop-change-mgmt", - "itop-problem-mgmt", - "itop-knownerror-mgmt", - 'authent-cas', - 'authent-external', - 'authent-ldap', - 'authent-local', - 'itop-backup', - 'itop-config', - 'itop-sla-computation', - 'itop-bridge-virtualization-storage', - ]); - sort($aExpectedInstallationModules); - - $this->assertEquals($aExpectedInstallationModules, $aSelectedModules); - - $this->ValidateNonItilExtensionComputation($oInstallationFileService, true, $bExpectedAdditionalExtensions); - } - - -} From cfb9fae6482f17002e4a04a209394a817f440173 Mon Sep 17 00:00:00 2001 From: odain Date: Fri, 12 Apr 2024 16:49:11 +0200 Subject: [PATCH 5/6] =?UTF-8?q?N=C2=B07407=20-=20fix=20previous=20commit?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../InstallationFileServiceTest.php | 803 ++++++++++++++++++ 1 file changed, 803 insertions(+) diff --git a/tests/php-unit-tests/unitary-tests/setup/unattended-install/InstallationFileServiceTest.php b/tests/php-unit-tests/unitary-tests/setup/unattended-install/InstallationFileServiceTest.php index e69de29bb..afd1fa38f 100644 --- a/tests/php-unit-tests/unitary-tests/setup/unattended-install/InstallationFileServiceTest.php +++ b/tests/php-unit-tests/unitary-tests/setup/unattended-install/InstallationFileServiceTest.php @@ -0,0 +1,803 @@ +RecurseMoveDir(APPROOT."data/production-modules/$sModuleId", APPROOT . "datamodels/2.x/$sModuleId"); + } + + private function GetInstallationPath() : string { + return realpath(__DIR__ . '/resources/installation.xml'); + } + + private function GetModuleData($sCategory, bool $bIsVisible, bool $bIsAutoSelect, bool $bProductionModulesInRootDir=false) : array { + $sRootDir = $bProductionModulesInRootDir ? APPROOT.'data/production-modules/' : ''; + + $aModuleData = [ + 'category' => $sCategory, + 'visible' => $bIsVisible, + 'root_dir' => $sRootDir, + ]; + + if ($bIsAutoSelect){ + $aModuleData['auto_select'] = true; + } + + return $aModuleData; + } + + public function ProcessDefaultModulesProvider() { + parent::setUp(); + return [ + 'root module' => [ + 'aAllFoundModules' => [ + '_Root_' => $this->GetModuleData('authentication', false, false, true), + ], + 'aExpectedSelectedModules' => [], + 'aExpectedAutoSelectModules' => [], + ], + 'auto-select root module' => [ + 'aAllFoundModules' => [ + '_Root_' => $this->GetModuleData('authentication', false, true, true), + ], + 'aExpectedSelectedModules' => [], + 'aExpectedAutoSelectModules' => [], + ], + 'autoselect module only' => [ + 'aAllFoundModules' => [ + 'autoselect-only' => $this->GetModuleData('mycategory', true, true), + ], + 'aExpectedSelectedModules' => [], + 'aExpectedAutoSelectModules' => ['autoselect-only'], + ], + 'autoselect/invisible module' => [ + 'aAllFoundModules' => [ + 'autoselect-only' => $this->GetModuleData('mycategory', false, true), + ], + 'aExpectedSelectedModules' => [], + 'aExpectedAutoSelectModules' => ['autoselect-only'], + ], + 'autoselect/invisible/in-root-dir module' => [ + 'aAllFoundModules' => [ + 'autoselect-only' => $this->GetModuleData('mycategory', false, true , true), + ], + 'aExpectedSelectedModules' => [], + 'aExpectedAutoSelectModules' => ['autoselect-only'], + ], + 'visible/authent module' => [ + 'aAllFoundModules' => [ + 'authent-module' => $this->GetModuleData('authentication', true, false , false), + ], + 'aExpectedSelectedModules' => ['authent-module'], + 'aExpectedAutoSelectModules' => [], + ], + 'invisible module' => [ + 'aAllFoundModules' => [ + 'visible-module' => $this->GetModuleData('mycategory', false, false , false), + ], + 'aExpectedSelectedModules' => ['visible-module'], + 'aExpectedAutoSelectModules' => [], + ], + 'in-root-dir module' => [ + 'aAllFoundModules' => [ + 'in-root-dir-module' => $this->GetModuleData('mycategory', true, false , true), + ], + 'aExpectedSelectedModules' => ['in-root-dir-module'], + 'aExpectedAutoSelectModules' => [], + ], + ]; + } + /** + * @dataProvider ProcessDefaultModulesProvider + */ + public function testProcessDefaultModules(array $aAllFoundModules, array $aExpectedSelectedModules, array $aExpectedAutoSelectModules) { + $oInstallationFileService = new InstallationFileService('', 'production', [], true); + + $oProductionEnv = $this->createMock(RunTimeEnvironment::class); + $oProductionEnv->expects($this->once()) + ->method('AnalyzeInstallation') + ->willReturn($aAllFoundModules); + + $oInstallationFileService->SetProductionEnv($oProductionEnv); + $oInstallationFileService->ProcessDefaultModules(); + + sort($aExpectedSelectedModules); + $aModules = array_keys($oInstallationFileService->GetSelectedModules()); + sort($aModules); + + $this->assertEquals($aExpectedSelectedModules, $aModules); + + $aAutoSelectModules = array_keys($oInstallationFileService->GetAutoSelectModules()); + sort($aAutoSelectModules); + $this->assertEquals($aExpectedAutoSelectModules, $aAutoSelectModules); + } + + public function ProcessInstallationChoicesProvider() { + return [ + 'all checked' => [ true ], + 'only defaut + mandatory' => [ false ], + ]; + } + + /** + * @dataProvider ProcessInstallationChoicesProvider + */ + public function testProcessInstallationChoices($bInstallationOptionalChoicesChecked) { + $sPath = $this->GetInstallationPath(); + $oInstallationFileService = new InstallationFileService($sPath, 'production', [], $bInstallationOptionalChoicesChecked); + $oProductionEnv = $this->createMock(RunTimeEnvironment::class); + $oProductionEnv->expects($this->never()) + ->method('AnalyzeInstallation'); + $oInstallationFileService->SetProductionEnv($oProductionEnv); + + $oInstallationFileService->ProcessInstallationChoices(); + $aExpectedModules = [ + "itop-config-mgmt", + "itop-attachments", + "itop-profiles-itil", + "itop-welcome-itil", + "itop-tickets", + "itop-files-information", + "combodo-db-tools", + "itop-core-update", + "itop-hub-connector", + "itop-oauth-client", + "itop-datacenter-mgmt", + "itop-endusers-devices", + "itop-storage-mgmt", + "itop-virtualization-mgmt", + "itop-service-mgmt", + "itop-request-mgmt", + "itop-portal", + "itop-portal-base", + "itop-change-mgmt", + ]; + + $aExpectedUnselectedModules = [ + 'itop-change-mgmt-itil', + 'itop-incident-mgmt-itil', + 'itop-request-mgmt-itil', + 'itop-service-mgmt-provider', + ]; + + if ($bInstallationOptionalChoicesChecked){ + $aExpectedModules []= "itop-problem-mgmt"; + $aExpectedModules []= "itop-knownerror-mgmt"; + } else { + $aExpectedUnselectedModules []= "itop-problem-mgmt"; + $aExpectedUnselectedModules []= "itop-knownerror-mgmt"; + } + + sort($aExpectedModules); + $aModules = array_keys($oInstallationFileService->GetSelectedModules()); + sort($aModules); + + $this->assertEquals($aExpectedModules, $aModules); + + $aUnselectedModules = array_keys($oInstallationFileService->GetUnSelectedModules()); + sort($aExpectedUnselectedModules); + sort($aUnselectedModules); + $this->assertEquals($aExpectedUnselectedModules, $aUnselectedModules); + + $aGetAfterComputationSelectedExtensions = $oInstallationFileService->GetAfterComputationSelectedExtensions(); + sort($aGetAfterComputationSelectedExtensions); + $aExpectedExtensions = [ + 'itop-change-mgmt-simple', + 'itop-config-mgmt-core', + 'itop-config-mgmt-datacenter', + 'itop-config-mgmt-end-user', + 'itop-config-mgmt-storage', + 'itop-config-mgmt-virtualization', + 'itop-service-mgmt-enterprise', + 'itop-ticket-mgmt-simple-ticket', + 'itop-ticket-mgmt-simple-ticket-enhanced-portal', + ]; + if ($bInstallationOptionalChoicesChecked){ + $aExpectedExtensions []= "itop-problem-mgmt"; + $aExpectedExtensions []= 'itop-kown-error-mgmt'; + } + sort($aExpectedExtensions); + $this->assertEquals($aExpectedExtensions, $aGetAfterComputationSelectedExtensions); + + $this->ValidateNonItilExtensionComputation($oInstallationFileService, $bInstallationOptionalChoicesChecked); + } + + /** + * @dataProvider ItilExtensionProvider + */ + public function testProcessInstallationChoicesWithItilChoices(array $aSelectedExtensions, bool $bKnownMgtSelected, bool $bCoreMgtSelected) { + $sPath = $this->GetInstallationPath(); + $oInstallationFileService = new InstallationFileService($sPath, 'production', $aSelectedExtensions, false); + $oProductionEnv = $this->createMock(RunTimeEnvironment::class); + $oProductionEnv->expects($this->never()) + ->method('AnalyzeInstallation'); + $oInstallationFileService->SetProductionEnv($oProductionEnv); + + $oInstallationFileService->ProcessInstallationChoices(); + + $aExpectedInstallationModules = [ + "itop-config-mgmt", + "itop-attachments", + "itop-profiles-itil", + "itop-welcome-itil", + "itop-tickets", + "itop-files-information", + "combodo-db-tools", + "itop-core-update", + "itop-hub-connector", + "itop-oauth-client", + "itop-datacenter-mgmt", + "itop-endusers-devices", + "itop-storage-mgmt", + "itop-virtualization-mgmt", + "itop-service-mgmt", + "itop-request-mgmt-itil", + "itop-incident-mgmt-itil", + "itop-portal", + "itop-portal-base", + "itop-change-mgmt-itil", + ]; + if ($bKnownMgtSelected){ + $aExpectedInstallationModules []= "itop-knownerror-mgmt"; + } + + sort($aExpectedInstallationModules); + $aModules = array_keys($oInstallationFileService->GetSelectedModules()); + sort($aModules); + + $this->assertEquals($aExpectedInstallationModules, $aModules); + + $aExpectedUnselectedModules = [ + 0 => 'itop-change-mgmt', + 1 => 'itop-problem-mgmt', + 2 => 'itop-request-mgmt', + 3 => 'itop-service-mgmt-provider', + ]; + if (!$bKnownMgtSelected){ + $aExpectedUnselectedModules[]='itop-knownerror-mgmt'; + } + $aUnselectedModules = array_keys($oInstallationFileService->GetUnSelectedModules()); + sort($aExpectedUnselectedModules); + sort($aUnselectedModules); + $this->assertEquals($aExpectedUnselectedModules, $aUnselectedModules); + + $this->ValidateItilExtensionComputation($oInstallationFileService, $bKnownMgtSelected, $bCoreMgtSelected); + } + + public function GetDefaultModulesProvider() { + return [ + 'check all possible modules' => [true], + 'only minimum defaul/mandatory from installation.xml' => [false], + ]; + } + + private function GetMockListOfFoundModules() : array { + $sJsonContent = file_get_contents(realpath(__DIR__ . '/resources/AnalyzeInstallation.json')); + $sJsonContent = str_replace('ROOTDIR_TOREPLACE', APPROOT, $sJsonContent); + return json_decode($sJsonContent, true); + } + + /** + * @dataProvider GetDefaultModulesProvider + */ + public function testGetAllSelectedModules($bInstallationOptionalChoicesChecked=false) { + $sPath = $this->GetInstallationPath(); + $oInstallationFileService = new InstallationFileService($sPath, 'production', [], $bInstallationOptionalChoicesChecked); + + $oProductionEnv = $this->createMock(RunTimeEnvironment::class); + $oProductionEnv->expects($this->once()) + ->method('AnalyzeInstallation') + ->willReturn($this->GetMockListOfFoundModules()); + $oInstallationFileService->SetProductionEnv($oProductionEnv); + + $oItopExtensionsMap = $this->createMock(ItopExtensionsMap::class); + $oItopExtensionsMap->expects($this->once()) + ->method('GetAllExtensions') + ->willReturn([]); + $oInstallationFileService->SetItopExtensionsMap($oItopExtensionsMap); + + $oInstallationFileService->Init(); + + $aSelectedModules = $oInstallationFileService->GetSelectedModules(); + $aExpectedInstallationModules = [ + "itop-config-mgmt", + "itop-attachments", + "itop-profiles-itil", + "itop-welcome-itil", + "itop-tickets", + "itop-files-information", + "combodo-db-tools", + "itop-core-update", + "itop-hub-connector", + "itop-oauth-client", + "itop-datacenter-mgmt", + "itop-endusers-devices", + "itop-storage-mgmt", + "itop-virtualization-mgmt", + "itop-service-mgmt", + "itop-request-mgmt", + "itop-portal", + "itop-portal-base", + "itop-change-mgmt", + ]; + if ($bInstallationOptionalChoicesChecked){ + $aExpectedInstallationModules []= "itop-problem-mgmt"; + $aExpectedInstallationModules []= "itop-knownerror-mgmt"; + } + + $aExpectedAuthenticationModules = [ + 'authent-cas', + 'authent-external', + 'authent-ldap', + 'authent-local', + ]; + + $aUnvisibleModules = [ + 'itop-backup', + 'itop-config', + 'itop-sla-computation', + ]; + + $aAutoSelectedModules = [ + 'itop-bridge-virtualization-storage', + ]; + + $this->checkModuleList("installation.xml choices", $aExpectedInstallationModules, $aSelectedModules); + $this->checkModuleList("authentication category", $aExpectedAuthenticationModules, $aSelectedModules); + $this->checkModuleList("unvisible", $aUnvisibleModules, $aSelectedModules); + $this->checkModuleList("auto-select", $aAutoSelectedModules, $aSelectedModules); + $this->assertEquals([], $aSelectedModules, "there should be no more modules remaining apart from below lists"); + + $this->ValidateNonItilExtensionComputation($oInstallationFileService, $bInstallationOptionalChoicesChecked); + } + + private function ValidateNonItilExtensionComputation($oInstallationFileService, bool $bInstallationOptionalChoicesChecked, array $aAdditionalExtensions=[]) { + $aGetAfterComputationSelectedExtensions = $oInstallationFileService->GetAfterComputationSelectedExtensions(); + sort($aGetAfterComputationSelectedExtensions); + $aExpectedExtensions = array_merge($aAdditionalExtensions, [ + 'itop-change-mgmt-simple', + 'itop-config-mgmt-core', + 'itop-config-mgmt-datacenter', + 'itop-config-mgmt-end-user', + 'itop-config-mgmt-storage', + 'itop-config-mgmt-virtualization', + 'itop-service-mgmt-enterprise', + 'itop-ticket-mgmt-simple-ticket', + 'itop-ticket-mgmt-simple-ticket-enhanced-portal', + ]); + if ($bInstallationOptionalChoicesChecked){ + $aExpectedExtensions []= "itop-problem-mgmt"; + $aExpectedExtensions []= 'itop-kown-error-mgmt'; + } + sort($aExpectedExtensions); + $this->assertEquals($aExpectedExtensions, $aGetAfterComputationSelectedExtensions); + } + + private function ValidateItilExtensionComputation($oInstallationFileService, bool $bKnownMgtSelected, bool $bCoreMgtSelected) { + $aGetAfterComputationSelectedExtensions = $oInstallationFileService->GetAfterComputationSelectedExtensions(); + sort($aGetAfterComputationSelectedExtensions); + $aExpectedExtensions = [ + 'itop-change-mgmt-itil', + 'itop-config-mgmt-datacenter', + 'itop-config-mgmt-end-user', + 'itop-config-mgmt-storage', + 'itop-config-mgmt-virtualization', + 'itop-service-mgmt-enterprise', + 'itop-ticket-mgmt-itil', + 'itop-ticket-mgmt-itil-enhanced-portal', + 'itop-ticket-mgmt-itil-incident', + 'itop-ticket-mgmt-itil-user-request', + ]; + if ($bCoreMgtSelected){ + $aExpectedExtensions []= 'itop-config-mgmt-core'; + } + if ($bKnownMgtSelected){ + $aExpectedExtensions []= 'itop-kown-error-mgmt'; + } + sort($aExpectedExtensions); + $this->assertEquals($aExpectedExtensions, $aGetAfterComputationSelectedExtensions); + } + + private function GetSelectedItilExtensions(bool $coreExtensionIncluded, bool $bKnownMgtIncluded) : array { + $aExtensions = [ + 'itop-config-mgmt-datacenter', + 'itop-config-mgmt-end-user', + 'itop-config-mgmt-storage', + 'itop-config-mgmt-virtualization', + 'itop-service-mgmt-enterprise', + 'itop-ticket-mgmt-itil', + 'itop-ticket-mgmt-itil-user-request', + 'itop-ticket-mgmt-itil-incident', + 'itop-ticket-mgmt-itil-enhanced-portal', + 'itop-change-mgmt-itil', + ]; + + if ($coreExtensionIncluded){ + $aExtensions[]= 'itop-config-mgmt-core'; + } + + if ($bKnownMgtIncluded){ + $aExtensions[]= 'itop-kown-error-mgmt'; + } + + return $aExtensions; + + } + + public function ItilExtensionProvider() { + return [ + 'all itil extensions + INCLUDING known-error-mgt' => [ + 'aSelectedExtensions' => $this->GetSelectedItilExtensions(true, true), + 'bKnownMgtSelected' => true, + 'bCoreMgtSelected' => true, + ], + 'all itil extensions WITHOUT known-error-mgt' => [ + 'aSelectedExtensions' => $this->GetSelectedItilExtensions(true, false), + 'bKnownMgtSelected' => false, + 'bCoreMgtSelected' => true, + ], + 'all itil extensions WITHOUT core mandatory ones + INCLUDING known-error-mgt' => [ + 'aSelectedExtensions' => $this->GetSelectedItilExtensions(false, true), + 'bKnownMgtSelected' => true, + 'bCoreMgtSelected' => false, + ], + 'all itil extensions WITHOUT core mandatory ones and WITHOUT known-error-mgt' => [ + 'aSelectedExtensions' => $this->GetSelectedItilExtensions(false, false), + 'bKnownMgtSelected' => false, + 'bCoreMgtSelected' => false, + ], + ]; + } + + /** + * @dataProvider ItilExtensionProvider + */ + public function testGetAllSelectedModules_withItilExtensions(array $aSelectedExtensions, bool $bKnownMgtSelected, bool $bCoreMgtSelected) { + $sPath = $this->GetInstallationPath(); + $oInstallationFileService = new InstallationFileService($sPath, 'production', $aSelectedExtensions); + + $oProductionEnv = $this->createMock(RunTimeEnvironment::class); + $oProductionEnv->expects($this->once()) + ->method('AnalyzeInstallation') + ->willReturn($this->GetMockListOfFoundModules()); + $oInstallationFileService->SetProductionEnv($oProductionEnv); + + $oItopExtensionsMap = $this->createMock(ItopExtensionsMap::class); + $oItopExtensionsMap->expects($this->once()) + ->method('GetAllExtensions') + ->willReturn([]); + $oInstallationFileService->SetItopExtensionsMap($oItopExtensionsMap); + + $oInstallationFileService->Init(); + + $aSelectedModules = $oInstallationFileService->GetSelectedModules(); + $aExpectedInstallationModules = [ + "itop-config-mgmt", + "itop-attachments", + "itop-profiles-itil", + "itop-welcome-itil", + "itop-tickets", + "itop-files-information", + "combodo-db-tools", + "itop-core-update", + "itop-hub-connector", + "itop-oauth-client", + "itop-datacenter-mgmt", + "itop-endusers-devices", + "itop-storage-mgmt", + "itop-virtualization-mgmt", + "itop-service-mgmt", + "itop-request-mgmt-itil", + "itop-incident-mgmt-itil", + "itop-portal", + "itop-portal-base", + "itop-change-mgmt-itil", + "itop-full-itil", + ]; + if ($bKnownMgtSelected){ + $aExpectedInstallationModules []= "itop-knownerror-mgmt"; + } + + $aExpectedAuthenticationModules = [ + 'authent-cas', + 'authent-external', + 'authent-ldap', + 'authent-local', + ]; + + $aUnvisibleModules = [ + 'itop-backup', + 'itop-config', + 'itop-sla-computation', + ]; + + $aAutoSelectedModules = [ + 'itop-bridge-virtualization-storage', + ]; + + $this->checkModuleList("installation.xml choices", $aExpectedInstallationModules, $aSelectedModules); + $this->checkModuleList("authentication category", $aExpectedAuthenticationModules, $aSelectedModules); + $this->checkModuleList("unvisible", $aUnvisibleModules, $aSelectedModules); + $this->checkModuleList("auto-select", $aAutoSelectedModules, $aSelectedModules); + $this->assertEquals([], $aSelectedModules, "there should be no more modules remaining apart from below lists"); + + $this->ValidateItilExtensionComputation($oInstallationFileService, $bKnownMgtSelected, $bCoreMgtSelected); + } + + private function checkModuleList(string $sModuleCategory, array $aExpectedModuleList, array &$aSelectedModules) { + $aMissingModules = []; + + foreach ($aExpectedModuleList as $sModuleId){ + if (! array_key_exists($sModuleId, $aSelectedModules)){ + $aMissingModules[]=$sModuleId; + } else { + unset($aSelectedModules[$sModuleId]); + } + } + + $this->assertEquals([], $aMissingModules, "$sModuleCategory modules are missing"); + + } + + private function RecurseMoveDir($sFromDir, $sToDir) { + if (! is_dir($sFromDir)){ + return; + } + + if (! is_dir($sToDir)){ + @mkdir($sToDir); + } + + foreach (glob("$sFromDir/*") as $sPath){ + $sToPath = $sToDir.'/'.basename($sPath); + if (is_file($sPath)){ + @rename($sPath, $sToPath); + } else { + $this->RecurseMoveDir($sPath, $sToPath); + } + } + + @rmdir($sFromDir); + } + + private function CreateItopExtension(string $sSource, string $sCode, array $aModules, array $aMissingDependencies, bool $bIsVisible) : iTopExtension{ + $oExtension = new iTopExtension(); + $oExtension->sCode = $sCode; + $oExtension->sSource = $sSource; + $oExtension->aModules = $aModules; + $oExtension->aMissingDependencies = $aMissingDependencies; + $oExtension->bVisible = $bIsVisible; + return $oExtension; + } + + public function CanChooseUnpackageExtensionProvider() { + return [ + 'extension in SOURCE_REMOTE' => [ + 'sCode' => "extension-from-designer", + 'bInstallationOptionalChoicesChecked' => false, + 'sSource' => 'data', + 'bExpectedRes' => true + ], + 'extension in SOURCE_WIZARD' => [ + 'sCode' => 'extension-from-package', + 'bInstallationOptionalChoicesChecked' => true, + 'sSource' => 'datamodels', + 'bExpectedRes' => false + ], + 'extension in SOURCE_MANUAL + optional OK' => [ + 'sCode' => 'extension-from-package', + 'bInstallationOptionalChoicesChecked' => true, + 'sSource' => 'extensions', + 'bExpectedRes' => true + ], + 'extension in SOURCE_MANUAL + optional NOT OK' => [ + 'sCode' => 'extension-from-package', + 'bInstallationOptionalChoicesChecked' => false, + 'sSource' => 'extensions', + 'bExpectedRes' => false + ], + ]; + } + + /** + * @dataProvider CanChooseUnpackageExtensionProvider + */ + public function testCanChooseUnpackageExtension(string $sCode, bool $bInstallationOptionalChoicesChecked, string $sSource, bool $bExpectedRes) { + $sPath = $this->GetInstallationPath(); + $oInstallationFileService = new InstallationFileService($sPath, 'production', [], $bInstallationOptionalChoicesChecked); + + $oItopExtension = $this->CreateItopExtension($sSource, $sCode, [], [], true); + $this->assertEquals($bExpectedRes, $oInstallationFileService->CanChooseUnpackageExtension($oItopExtension)); + } + + public function ProcessExtensionModulesNotSpecifiedInChoicesProvider() { + return [ + 'extensions to install OK' => [ + 'aExtensionData' => [ + 'extension1' => [ + //'itop-request-mgmt-itil', //unselected + 'combodo-monitoring', + 'itop-config-mgmt', //already selected + ], + 'extension2' => [ + //'itop-incident-mgmt-itil', //unselected + 'combodo-monitoring2', + 'itop-attachments', //already selected + ] + ], + 'bExtensionCanBeChoosen' => true, + 'aMissingDependencies' => [], + 'bIsVisible' => true, + 'bExpectedAdditionalExtensions' => [ + 'extension1', 'extension2' + ], + 'bExpectedAdditionalModules' => [ + 'combodo-monitoring', 'combodo-monitoring2' + ] + ], + 'extensions to install cannot be choose,' => [ + 'aExtensionData' => [ + 'extension1' => [ + 'combodo-monitoring', + ], + 'extension2' => [ + 'combodo-monitoring2', + ] + ], + 'bExtensionCanBeChoosen' => false, + 'aMissingDependencies' => [], + 'bIsVisible' => true, + 'bExpectedAdditionalExtensions' => [], + 'bExpectedAdditionalModules' => [] + ], + 'extensions to install not visible' => [ + 'aExtensionData' => [ + 'extension1' => [ + 'combodo-monitoring', + ], + 'extension2' => [ + 'combodo-monitoring2', + ] + ], + 'bExtensionCanBeChoosen' => true, + 'aMissingDependencies' => [], + 'bIsVisible' => false, + 'bExpectedAdditionalExtensions' => [], + 'bExpectedAdditionalModules' => [] + ], + 'extensions to install with missing dependencies' => [ + 'aExtensionData' => [ + 'extension1' => [ + 'combodo-monitoring', + ], + 'extension2' => [ + 'combodo-monitoring2', + ] + ], + 'bExtensionCanBeChoosen' => true, + 'aMissingDependencies' => ['missing-module'], + 'bIsVisible' => true, + 'bExpectedAdditionalExtensions' => [], + 'bExpectedAdditionalModules' => [] + ], + 'extensions to install with unselectable ITIL module' => [ + 'aExtensionData' => [ + 'extension1' => [ + 'itop-request-mgmt-itil', //unselected + 'combodo-monitoring', + ], + 'extension2' => [ + 'itop-incident-mgmt-itil', //unselected + 'combodo-monitoring2', + ] + ], + 'bExtensionCanBeChoosen' => true, + 'aMissingDependencies' => [], + 'bIsVisible' => true, + 'bExpectedAdditionalExtensions' => [], + 'bExpectedAdditionalModules' => [] + ], + 'extensions already processed' => [ + 'aExtensionData' => [ + 'itop-config-mgmt-core' => [ + 'itop-config-mgmt', //already selected + ], + ], + 'bExtensionCanBeChoosen' => true, + 'aMissingDependencies' => [], + 'bIsVisible' => true, + 'bExpectedAdditionalExtensions' => [ + ], + 'bExpectedAdditionalModules' => [ + ] + ], + ]; + } + + /** + * @dataProvider ProcessExtensionModulesNotSpecifiedInChoicesProvider + */ + public function testProcessExtensionModulesNotSpecifiedInChoices(array $aExtensionData, bool $bExtensionCanBeChoosen, + array $aMissingDependencies, bool $bIsVisible, array $bExpectedAdditionalExtensions, array $bExpectedAdditionalModules) { + $sPath = $this->GetInstallationPath(); + $oInstallationFileService = new InstallationFileService($sPath, 'production', [], true); + + $oProductionEnv = $this->createMock(RunTimeEnvironment::class); + $oProductionEnv->expects($this->once()) + ->method('AnalyzeInstallation') + ->willReturn($this->GetMockListOfFoundModules()); + $oInstallationFileService->SetProductionEnv($oProductionEnv); + + $oItopExtensionsMap = $this->createMock(ItopExtensionsMap::class); + $aItopExtensionMap = []; + + $sSource = $bExtensionCanBeChoosen ? iTopExtension::SOURCE_REMOTE : iTopExtension::SOURCE_WIZARD; + foreach ($aExtensionData as $sExtensionCode => $aModules){ + $aItopExtensionMap[]= $this->CreateItopExtension($sSource, $sExtensionCode, $aModules, $aMissingDependencies, $bIsVisible); + } + $oItopExtensionsMap->expects($this->once()) + ->method('GetAllExtensions') + ->willReturn($aItopExtensionMap); + $oInstallationFileService->SetItopExtensionsMap($oItopExtensionsMap); + + $oInstallationFileService->Init(); + + $aSelectedModules = array_keys($oInstallationFileService->GetSelectedModules()); + sort($aSelectedModules); + $aExpectedInstallationModules = array_merge($bExpectedAdditionalModules, [ + "itop-config-mgmt", + "itop-attachments", + "itop-profiles-itil", + "itop-welcome-itil", + "itop-tickets", + "itop-files-information", + "combodo-db-tools", + "itop-core-update", + "itop-hub-connector", + "itop-oauth-client", + "itop-datacenter-mgmt", + "itop-endusers-devices", + "itop-storage-mgmt", + "itop-virtualization-mgmt", + "itop-service-mgmt", + "itop-request-mgmt", + "itop-portal", + "itop-portal-base", + "itop-change-mgmt", + "itop-problem-mgmt", + "itop-knownerror-mgmt", + 'authent-cas', + 'authent-external', + 'authent-ldap', + 'authent-local', + 'itop-backup', + 'itop-config', + 'itop-sla-computation', + 'itop-bridge-virtualization-storage', + ]); + sort($aExpectedInstallationModules); + + $this->assertEquals($aExpectedInstallationModules, $aSelectedModules); + + $this->ValidateNonItilExtensionComputation($oInstallationFileService, true, $bExpectedAdditionalExtensions); + } + + +} From 6cb3519308a405800f99f750fa64e35f415a7fa5 Mon Sep 17 00:00:00 2001 From: odain Date: Fri, 12 Apr 2024 16:59:56 +0200 Subject: [PATCH 6/6] =?UTF-8?q?N=C2=B07407=20-=20test=20readability?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../InstallationFileServiceTest.php | 117 +++++------------- 1 file changed, 29 insertions(+), 88 deletions(-) diff --git a/tests/php-unit-tests/unitary-tests/setup/unattended-install/InstallationFileServiceTest.php b/tests/php-unit-tests/unitary-tests/setup/unattended-install/InstallationFileServiceTest.php index afd1fa38f..b463cff36 100644 --- a/tests/php-unit-tests/unitary-tests/setup/unattended-install/InstallationFileServiceTest.php +++ b/tests/php-unit-tests/unitary-tests/setup/unattended-install/InstallationFileServiceTest.php @@ -18,9 +18,6 @@ class InstallationFileServiceTest extends ItopTestCase { protected function tearDown(): void { parent::tearDown(); - - $sModuleId = "itop-problem-mgmt"; - $this->RecurseMoveDir(APPROOT."data/production-modules/$sModuleId", APPROOT . "datamodels/2.x/$sModuleId"); } private function GetInstallationPath() : string { @@ -265,10 +262,10 @@ class InstallationFileServiceTest extends ItopTestCase { $this->assertEquals($aExpectedInstallationModules, $aModules); $aExpectedUnselectedModules = [ - 0 => 'itop-change-mgmt', - 1 => 'itop-problem-mgmt', - 2 => 'itop-request-mgmt', - 3 => 'itop-service-mgmt-provider', + 'itop-change-mgmt', + 'itop-problem-mgmt', + 'itop-request-mgmt', + 'itop-service-mgmt-provider', ]; if (!$bKnownMgtSelected){ $aExpectedUnselectedModules[]='itop-knownerror-mgmt'; @@ -315,7 +312,6 @@ class InstallationFileServiceTest extends ItopTestCase { $oInstallationFileService->Init(); - $aSelectedModules = $oInstallationFileService->GetSelectedModules(); $aExpectedInstallationModules = [ "itop-config-mgmt", "itop-attachments", @@ -336,34 +332,26 @@ class InstallationFileServiceTest extends ItopTestCase { "itop-portal", "itop-portal-base", "itop-change-mgmt", + 'authent-cas', + 'authent-external', + 'authent-ldap', + 'authent-local', + 'itop-backup', + 'itop-config', + 'itop-sla-computation', + 'itop-bridge-virtualization-storage', ]; + if ($bInstallationOptionalChoicesChecked){ $aExpectedInstallationModules []= "itop-problem-mgmt"; $aExpectedInstallationModules []= "itop-knownerror-mgmt"; } - $aExpectedAuthenticationModules = [ - 'authent-cas', - 'authent-external', - 'authent-ldap', - 'authent-local', - ]; + sort($aExpectedInstallationModules); - $aUnvisibleModules = [ - 'itop-backup', - 'itop-config', - 'itop-sla-computation', - ]; - - $aAutoSelectedModules = [ - 'itop-bridge-virtualization-storage', - ]; - - $this->checkModuleList("installation.xml choices", $aExpectedInstallationModules, $aSelectedModules); - $this->checkModuleList("authentication category", $aExpectedAuthenticationModules, $aSelectedModules); - $this->checkModuleList("unvisible", $aUnvisibleModules, $aSelectedModules); - $this->checkModuleList("auto-select", $aAutoSelectedModules, $aSelectedModules); - $this->assertEquals([], $aSelectedModules, "there should be no more modules remaining apart from below lists"); + $aSelectedModules = array_keys($oInstallationFileService->GetSelectedModules()); + sort($aSelectedModules); + $this->assertEquals($aExpectedInstallationModules, $aSelectedModules); $this->ValidateNonItilExtensionComputation($oInstallationFileService, $bInstallationOptionalChoicesChecked); } @@ -487,7 +475,7 @@ class InstallationFileServiceTest extends ItopTestCase { $oInstallationFileService->Init(); - $aSelectedModules = $oInstallationFileService->GetSelectedModules(); + $aSelectedModules = array_keys($oInstallationFileService->GetSelectedModules()); $aExpectedInstallationModules = [ "itop-config-mgmt", "itop-attachments", @@ -510,73 +498,26 @@ class InstallationFileServiceTest extends ItopTestCase { "itop-portal-base", "itop-change-mgmt-itil", "itop-full-itil", + 'authent-cas', + 'authent-external', + 'authent-ldap', + 'authent-local', + 'itop-backup', + 'itop-config', + 'itop-sla-computation', + 'itop-bridge-virtualization-storage', ]; if ($bKnownMgtSelected){ $aExpectedInstallationModules []= "itop-knownerror-mgmt"; } - $aExpectedAuthenticationModules = [ - 'authent-cas', - 'authent-external', - 'authent-ldap', - 'authent-local', - ]; - - $aUnvisibleModules = [ - 'itop-backup', - 'itop-config', - 'itop-sla-computation', - ]; - - $aAutoSelectedModules = [ - 'itop-bridge-virtualization-storage', - ]; - - $this->checkModuleList("installation.xml choices", $aExpectedInstallationModules, $aSelectedModules); - $this->checkModuleList("authentication category", $aExpectedAuthenticationModules, $aSelectedModules); - $this->checkModuleList("unvisible", $aUnvisibleModules, $aSelectedModules); - $this->checkModuleList("auto-select", $aAutoSelectedModules, $aSelectedModules); - $this->assertEquals([], $aSelectedModules, "there should be no more modules remaining apart from below lists"); + sort($aExpectedInstallationModules); + sort($aSelectedModules); + $this->assertEquals($aExpectedInstallationModules, $aSelectedModules); $this->ValidateItilExtensionComputation($oInstallationFileService, $bKnownMgtSelected, $bCoreMgtSelected); } - private function checkModuleList(string $sModuleCategory, array $aExpectedModuleList, array &$aSelectedModules) { - $aMissingModules = []; - - foreach ($aExpectedModuleList as $sModuleId){ - if (! array_key_exists($sModuleId, $aSelectedModules)){ - $aMissingModules[]=$sModuleId; - } else { - unset($aSelectedModules[$sModuleId]); - } - } - - $this->assertEquals([], $aMissingModules, "$sModuleCategory modules are missing"); - - } - - private function RecurseMoveDir($sFromDir, $sToDir) { - if (! is_dir($sFromDir)){ - return; - } - - if (! is_dir($sToDir)){ - @mkdir($sToDir); - } - - foreach (glob("$sFromDir/*") as $sPath){ - $sToPath = $sToDir.'/'.basename($sPath); - if (is_file($sPath)){ - @rename($sPath, $sToPath); - } else { - $this->RecurseMoveDir($sPath, $sToPath); - } - } - - @rmdir($sFromDir); - } - private function CreateItopExtension(string $sSource, string $sCode, array $aModules, array $aMissingDependencies, bool $bIsVisible) : iTopExtension{ $oExtension = new iTopExtension(); $oExtension->sCode = $sCode;