mirror of
https://github.com/Combodo/iTop.git
synced 2026-04-19 00:28:47 +02:00
🎨 Integration test code formatting
This commit is contained in:
@@ -16,7 +16,6 @@
|
||||
namespace Combodo\iTop\Test\UnitTest\Integration;
|
||||
|
||||
use Combodo\iTop\Test\UnitTest\ItopTestCase;
|
||||
use DOMDocument;
|
||||
use iTopDesignFormat;
|
||||
|
||||
|
||||
@@ -57,7 +56,8 @@ class iTopModulesPhpVersionIntegrationTest extends ItopTestCase
|
||||
$matches
|
||||
);
|
||||
|
||||
$this->assertRegExp("#$sExpectedVersion#", $matches[1], " $sPhpFile:2 file refer does not refer to current itop version ($sModuleName/$matches[1] does not match regexp $sModuleName/$sExpectedVersion)");
|
||||
$this->assertRegExp("#$sExpectedVersion#", $matches[1],
|
||||
" $sPhpFile:2 file refer does not refer to current itop version ($sModuleName/$matches[1] does not match regexp $sModuleName/$sExpectedVersion)");
|
||||
|
||||
}
|
||||
|
||||
@@ -68,16 +68,11 @@ class iTopModulesPhpVersionIntegrationTest extends ItopTestCase
|
||||
require_once APPROOT.'core/config.class.inc.php';
|
||||
require_once APPROOT.'application/utils.inc.php';
|
||||
|
||||
if (is_dir(APPROOT.'datamodels/2.x'))
|
||||
{
|
||||
if (is_dir(APPROOT.'datamodels/2.x')) {
|
||||
$DatamodelsPath = APPROOT.'datamodels/2.x';
|
||||
}
|
||||
elseif (is_dir(APPROOT.'datamodels/1.x'))
|
||||
{
|
||||
} elseif (is_dir(APPROOT.'datamodels/1.x')) {
|
||||
$DatamodelsPath = APPROOT.'datamodels/1.x';
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
throw new \Exception('Cannot local the datamodels directory');
|
||||
}
|
||||
|
||||
@@ -87,8 +82,7 @@ class iTopModulesPhpVersionIntegrationTest extends ItopTestCase
|
||||
$sExpectedVersion = \utils::GetItopMinorVersion().'\.\d+'; // ie: 2.7\.\d+ (and yes, the 1st dot should be escaped, but, hey, it is good enough as it, ans less complex to read)
|
||||
|
||||
$aTestCases = array();
|
||||
foreach ($aPhpFiles as $sPhpFile)
|
||||
{
|
||||
foreach ($aPhpFiles as $sPhpFile) {
|
||||
$aTestCases[$sPhpFile] = array(
|
||||
'sExpectedVersion' => $sExpectedVersion,
|
||||
'sPhpFile' => $sPhpFile,
|
||||
|
||||
@@ -57,14 +57,12 @@ class iTopModulesXmlVersionIntegrationTest extends ItopTestCase
|
||||
$oTransformedXml->load($sXmlFile);
|
||||
$oFormat = new iTopDesignFormat($oTransformedXml);
|
||||
|
||||
if ($oFormat->Convert())
|
||||
{
|
||||
if ($oFormat->Convert()) {
|
||||
// Compare the original and new format
|
||||
$sExpectedXmlVersion = ITOP_DESIGN_LATEST_VERSION;
|
||||
$this->assertSame($oTransformedXml->saveXML(), $oOriginalXml->saveXML(), "Datamodel file $sXmlFile:2 not in the latest format ($sExpectedXmlVersion)");
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->assertSame($oTransformedXml->saveXML(), $oOriginalXml->saveXML(),
|
||||
"Datamodel file $sXmlFile:2 not in the latest format ($sExpectedXmlVersion)");
|
||||
} else {
|
||||
$this->fail("Failed to convert $sXmlFile into the latest format");
|
||||
}
|
||||
}
|
||||
@@ -80,8 +78,7 @@ class iTopModulesXmlVersionIntegrationTest extends ItopTestCase
|
||||
$aXmlFiles[] = APPROOT.'application/datamodel.application.xml';
|
||||
|
||||
$aTestCases = array();
|
||||
foreach ($aXmlFiles as $sXmlFile)
|
||||
{
|
||||
foreach ($aXmlFiles as $sXmlFile) {
|
||||
$aTestCases[$sXmlFile] = array(
|
||||
'sXmlFile' => $sXmlFile,
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user