mirror of
https://github.com/Combodo/iTop.git
synced 2026-08-30 09:58:17 +02:00
N°9169 - Adapt ITSM designer connector to the new setup (FIX some unit tests)
This commit is contained in:
@@ -14,6 +14,8 @@ class CoreException extends Exception
|
||||
/**
|
||||
* CoreException constructor.
|
||||
*
|
||||
* ATTENTION: Logging here will break the CI
|
||||
*
|
||||
* @param string $sIssue error message
|
||||
* @param array|null $aContextData key/value array, value MUST implements _toString
|
||||
* @param string $sImpact
|
||||
@@ -56,7 +58,6 @@ class CoreException extends Exception
|
||||
$sMessage .= implode(', ', $aContextItems);
|
||||
}
|
||||
parent::__construct($sMessage, 0, $oPrevious);
|
||||
//IssueLog::Exception($sIssue, $this, null, $aContextData ?? []);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -1166,6 +1166,7 @@ class RunTimeEnvironment
|
||||
'ExceptionClass' => get_class($e),
|
||||
'ExceptionMessage' => $e->getMessage(),
|
||||
];
|
||||
IssueLog::Exception($sErrorMessage, $e, null, $aExceptionContextData);
|
||||
throw new CoreException($sErrorMessage, $aExceptionContextData, '', $e);
|
||||
}
|
||||
}
|
||||
@@ -1448,12 +1449,18 @@ class RunTimeEnvironment
|
||||
}
|
||||
|
||||
if (!is_dir($sSourcePath)) {
|
||||
throw new CoreException("Failed to find the source directory '$sSourcePath', please check the rights of the web server");
|
||||
$sErrorMessage = "Failed to find the source directory '$sSourcePath', please check the rights of the web server";
|
||||
$e = new CoreException($sErrorMessage);
|
||||
IssueLog::Exception($sErrorMessage, $e);
|
||||
throw $e;
|
||||
}
|
||||
|
||||
if (!is_dir($sBuildPath)) {
|
||||
if (!mkdir($sBuildPath)) {
|
||||
throw new CoreException("Failed to create directory '$sBuildPath', please check the rights of the web server");
|
||||
$sErrorMessage = "Failed to create directory '$sBuildPath', please check the rights of the web server";
|
||||
$e = new CoreException($sErrorMessage);
|
||||
IssueLog::Exception($sErrorMessage, $e);
|
||||
throw $e;
|
||||
} else {
|
||||
// adjust the rights if and only if the directory was just created
|
||||
// owner:rwx user/group:rx
|
||||
@@ -1472,7 +1479,10 @@ class RunTimeEnvironment
|
||||
foreach ($oExtensionsMap->GetAllExtensions() as $oExtension) {
|
||||
if (empty($oExtension->sCode)) {
|
||||
$sExtensionLabel = !empty($oExtension->sLabel) ? $oExtension->sLabel : $oExtension->sSourceDir;
|
||||
throw new CoreException(sprintf('Extension "%s" cannot be installed: Missing extension code', $sExtensionLabel));
|
||||
$sErrorMessage = sprintf('Extension "%s" cannot be installed: Missing extension code', $sExtensionLabel);
|
||||
$e = new CoreException($sErrorMessage);
|
||||
IssueLog::Exception($sErrorMessage, $e);
|
||||
throw $e;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -37,7 +37,7 @@ class DataAuditSequencerTest extends ItopTestCase
|
||||
'next-step' => 'copy',
|
||||
'next-step-label' => 'Copying data model files',
|
||||
'prev-step-success-message' => '',
|
||||
'percentage-completed' => 5,
|
||||
'percentage-completed' => 25,
|
||||
];
|
||||
$this->assertEquals($aExpected, $aRes);
|
||||
}
|
||||
@@ -70,11 +70,11 @@ class DataAuditSequencerTest extends ItopTestCase
|
||||
$aRes = $oSequencer->ExecuteStep('copy');
|
||||
$aExpected = [
|
||||
'status' => 1,
|
||||
'message' => 'Copying...',
|
||||
'message' => '',
|
||||
'next-step' => 'compile',
|
||||
'next-step-label' => 'Compiling the data model',
|
||||
'prev-step-success-message' => 'Data model files copied',
|
||||
'percentage-completed' => 20,
|
||||
'percentage-completed' => 50,
|
||||
];
|
||||
$this->assertEquals($aExpected, $aRes);
|
||||
}
|
||||
@@ -101,7 +101,7 @@ class DataAuditSequencerTest extends ItopTestCase
|
||||
'next-step' => 'setup-audit',
|
||||
'next-step-label' => 'Checking data consistency with the new data model',
|
||||
'prev-step-success-message' => 'Data model compilation completed',
|
||||
'percentage-completed' => 70,
|
||||
'percentage-completed' => 50,
|
||||
];
|
||||
$this->assertEquals($aExpected, $aRes);
|
||||
}
|
||||
@@ -126,7 +126,7 @@ class DataAuditSequencerTest extends ItopTestCase
|
||||
'next-step' => 'complete',
|
||||
'next-step-label' => 'Check Completed',
|
||||
'prev-step-success-message' => 'Data model compilation completed',
|
||||
'percentage-completed' => 100,
|
||||
'percentage-completed' => 75,
|
||||
];
|
||||
$this->assertEquals($aExpected, $aRes);
|
||||
}
|
||||
@@ -144,7 +144,7 @@ class DataAuditSequencerTest extends ItopTestCase
|
||||
'next-step' => 'complete',
|
||||
'next-step-label' => 'Check Completed',
|
||||
'prev-step-success-message' => 'Data model compilation completed',
|
||||
'percentage-completed' => 100,
|
||||
'percentage-completed' => 75,
|
||||
];
|
||||
$this->assertEquals($aExpected, $aRes);
|
||||
}
|
||||
@@ -171,7 +171,7 @@ class DataAuditSequencerTest extends ItopTestCase
|
||||
'next-step' => 'complete',
|
||||
'next-step-label' => 'Check Completed',
|
||||
'prev-step-success-message' => 'Data model compilation completed',
|
||||
'percentage-completed' => 100,
|
||||
'percentage-completed' => 66,
|
||||
];
|
||||
$this->assertEquals($aExpected, $aRes);
|
||||
}
|
||||
@@ -218,7 +218,7 @@ class DataAuditSequencerTest extends ItopTestCase
|
||||
'next-step' => 'complete',
|
||||
'next-step-label' => 'Check Completed',
|
||||
'prev-step-success-message' => 'Data consistency check completed',
|
||||
'percentage-completed' => 100,
|
||||
'percentage-completed' => 75,
|
||||
];
|
||||
$this->assertEquals($aExpected, $aRes);
|
||||
}
|
||||
@@ -255,8 +255,11 @@ class DataAuditSequencerTest extends ItopTestCase
|
||||
$oRunTimeEnvironment->expects($this->never())->method('GetFinalEnv')
|
||||
->willReturn('gabuzomeu');
|
||||
$oRunTimeEnvironment->expects($this->never())->method('DataToCleanupAudit');
|
||||
|
||||
$oSequencer = new DataAuditSequencer($this->GivenParams(), $oRunTimeEnvironment);
|
||||
$aAdditionalParams = [
|
||||
'mode' => 'update',
|
||||
'optional_steps' => ['setup-audit' => true ],
|
||||
];
|
||||
$oSequencer = new DataAuditSequencer($this->GivenParams($aAdditionalParams), $oRunTimeEnvironment);
|
||||
|
||||
$aRes = $oSequencer->ExecuteStep('setup-audit');
|
||||
$aExpected = [
|
||||
@@ -275,6 +278,9 @@ class DataAuditSequencerTest extends ItopTestCase
|
||||
$oParams = new PHPParameters();
|
||||
$aParams = array_merge([
|
||||
'mode' => 'install',
|
||||
'optional_steps' => [
|
||||
'copy' => true,
|
||||
],
|
||||
'database' => [
|
||||
'server' => 'server',
|
||||
'user' => 'user',
|
||||
|
||||
Reference in New Issue
Block a user