mirror of
https://github.com/Combodo/iTop.git
synced 2026-04-23 02:28:44 +02:00
test SDK enhancement: be able to compare moduleinstallation
ci: add log and hopefully fix hub test ci: fix all test that rely on CustomDataTC
This commit is contained in:
@@ -17,6 +17,7 @@ namespace Combodo\iTop\Test\UnitTest;
|
||||
use ArchivedObjectException;
|
||||
use CMDBObject;
|
||||
use CMDBSource;
|
||||
use Combodo\iTop\DBTools\Service\DBToolsUtils;
|
||||
use Combodo\iTop\Service\Events\EventService;
|
||||
use Config;
|
||||
use Contact;
|
||||
@@ -1553,4 +1554,32 @@ abstract class ItopDataTestCase extends ItopTestCase
|
||||
@chmod($sConfigPath, 0440);
|
||||
@unlink($this->sConfigTmpBackupFile);
|
||||
}
|
||||
|
||||
public function CompareCurrentAndPreviousModuleInstallations()
|
||||
{
|
||||
$this->RequireOnceItopFile('env-production/combodo-db-tools/src/Service/DBToolsUtils.php');
|
||||
$aPreviousInstallations = DBToolsUtils::GetPreviousModuleInstallationsByOffset(1);
|
||||
$aInstallations = DBToolsUtils::GetPreviousModuleInstallationsByOffset();
|
||||
$this->assertEquals($this->KeepModuleInstallationComparableFields($aPreviousInstallations), $this->KeepModuleInstallationComparableFields($aInstallations));
|
||||
}
|
||||
|
||||
public function KeepModuleInstallationComparableFields($aInstallations): array
|
||||
{
|
||||
$aRes = [];
|
||||
$aIgnoredFields = ['id', 'parent_id', 'installed', 'comment'];
|
||||
foreach ($aInstallations as $aData) {
|
||||
$aNewData = [];
|
||||
foreach ($aData as $sKey => $val) {
|
||||
if (in_array($sKey, $aIgnoredFields)) {
|
||||
continue;
|
||||
}
|
||||
$aNewData[$sKey] = $val;
|
||||
}
|
||||
$sName = $aNewData['name'];
|
||||
$aRes[$sName] = $aNewData;
|
||||
}
|
||||
|
||||
asort($aRes);
|
||||
return $aRes;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user