From a5b5d22e2f827a8d33e8911ab0b91685c773469b Mon Sep 17 00:00:00 2001 From: odain Date: Thu, 21 May 2026 11:31:48 +0200 Subject: [PATCH] =?UTF-8?q?N=C2=B09564=20-=20enhance=20simulate=20testing?= =?UTF-8?q?=20script=20to=20use=20local=20settings?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../simulate-audit-from-setup.php | 100 ++++++------------ 1 file changed, 32 insertions(+), 68 deletions(-) diff --git a/tests/php-unit-tests/unitary-tests/datamodels/2.x/combodo-data-feature-removal/simulate-audit-from-setup.php b/tests/php-unit-tests/unitary-tests/datamodels/2.x/combodo-data-feature-removal/simulate-audit-from-setup.php index 179bea189c..34d0c7e181 100644 --- a/tests/php-unit-tests/unitary-tests/datamodels/2.x/combodo-data-feature-removal/simulate-audit-from-setup.php +++ b/tests/php-unit-tests/unitary-tests/datamodels/2.x/combodo-data-feature-removal/simulate-audit-from-setup.php @@ -15,78 +15,42 @@ $aParams = [ new ContextTag(ContextTag::TAG_SETUP); $sToken = SetupUtils::CreateSetupToken(); -$aSelectedModules = [ - 'authent-cas', - 'authent-external', - 'authent-ldap', - 'authent-local', - 'combodo-backoffice-darkmoon-theme', - 'combodo-backoffice-fullmoon-high-contrast-theme', - 'combodo-backoffice-fullmoon-protanopia-deuteranopia-theme', - 'combodo-backoffice-fullmoon-tritanopia-theme', - 'combodo-data-feature-removal', - 'itop-backup', - 'itop-config', - 'itop-files-information', - 'itop-portal-base', - 'itop-profiles-itil', - 'itop-sla-computation', - 'itop-structure', - 'itop-welcome-itil', - 'itop-config-mgmt', - 'itop-attachments', - 'itop-tickets', - 'combodo-db-tools', - 'itop-core-update', - 'itop-hub-connector', - 'itop-oauth-client', - 'itop-themes-compat', - 'combodo-my-account', - 'combodo-my-account-user-info', - 'combodo-oauth2-client', - 'itop-attribute-class-set', - 'itop-attribute-encrypted-password', - 'itop-ui-copypaste', - 'itop-datacenter-mgmt', - 'itop-endusers-devices', - 'itop-storage-mgmt', - 'itop-virtualization-mgmt', - 'itop-bridge-cmdb-ticket', - 'itop-bridge-virtualization-storage', - 'itop-service-mgmt', - 'itop-bridge-cmdb-services', - 'itop-bridge-datacenter-mgmt-services', - 'itop-bridge-endusers-devices-services', - 'itop-bridge-storage-mgmt-services', - 'itop-bridge-virtualization-mgmt-services', - 'itop-request-mgmt', - 'itop-portal', - 'itop-change-mgmt', - 'itop-faq-light', - 'itop-knownerror-mgmt', - 'itop-problem-mgmt', - 'itop-system-information', - 'itop-log-mgmt', -]; +function GetLastestInstallFile(): ?string +{ + $aFiles = glob(APPROOT.'/log/install-*.xml'); + rsort($aFiles); + $iLatestCtime = 0; + $sLastFilePath = null; + foreach ($aFiles as $sFilePath) { + if (is_file($sFilePath)) { + $iCurrentCtime = filemtime($sFilePath); + if ($iCurrentCtime > $iLatestCtime) { + $iLatestCtime = $iCurrentCtime; + $sLastFilePath = $sFilePath; + } + } + } -$aSelectedExtensions = [ - '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', - 'itop-change-mgmt-simple', - 'itop-kown-error-mgmt', - 'itop-problem-mgmt', - 'itop-system-information', - 'itop-log-mgmt', -]; + return $sLastFilePath; +} $aRemovedExtensions = ['itop-container-mgmt' => 'Containerization']; +$sPath = GetLastestInstallFile(); +if (is_null($sPath)) { + throw new Exception("$sPath no installation XM. Launch a setup...."); +} +$aParams = new XMLParameters($sPath); +$aSelectedModules = array_filter($aParams->Get('selected_modules', []), static function ($element) { + global $aRemovedExtensions; + return ! array_key_exists($element, $aRemovedExtensions); +}); + +$aSelectedExtensions = array_filter($aParams->Get('selected_extensions', []), static function ($element) { + global $aRemovedExtensions; + return ! array_key_exists($element, $aRemovedExtensions); +}); + $aPostParams = [ "auth_user" => 'admin', "auth_pwd" => 'admin',