mirror of
https://github.com/Combodo/iTop.git
synced 2026-04-19 16:48:42 +02:00
CI migration/automation + new test to ease iTop release management
- new Jenkinsfile and .jenkins removal to launch phpunit/behat tests triggered on both iTop build and push. - N°3053 - Check XML conversion methods - N°3057 - New build recipe - N°3059 - Automatically set the documentation URLs - N°3052 - Check community modules XML version against latest version - N°3054 - Check community modules version against major version - N°3062 - setup.css file integrity test - N°3060 - Check consistency between the list of modules and installation.xml - Add exclusion group for CI - N°3061 - Automatically check the installation.xml consistency
This commit is contained in:
100
test/integration/iTopModulesPhpVersionChecklistTest.php
Normal file
100
test/integration/iTopModulesPhpVersionChecklistTest.php
Normal file
@@ -0,0 +1,100 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright (C) 2013-2020 Combodo SARL
|
||||
* This file is part of iTop.
|
||||
* iTop is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
* iTop is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
*/
|
||||
|
||||
namespace Combodo\iTop\Test\UnitTest\Integration;
|
||||
|
||||
use Combodo\iTop\Test\UnitTest\ItopTestCase;
|
||||
use DOMDocument;
|
||||
use iTopDesignFormat;
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @runTestsInSeparateProcesses
|
||||
* @preserveGlobalState disabled
|
||||
* @backupGlobals disabled
|
||||
*
|
||||
* @covers iTopDesignFormat
|
||||
*
|
||||
* @package Combodo\iTop\Test\UnitTest\Setup
|
||||
*/
|
||||
class iTopModulesPhpVersionIntegrationTest extends ItopTestCase
|
||||
{
|
||||
|
||||
|
||||
/**
|
||||
* Verify if the datamodel.*.xml files refer to the current itop version
|
||||
* This is an integration test
|
||||
*
|
||||
* @group skipPostBuild
|
||||
*
|
||||
* @dataProvider iTopModulesPhpVersionProvider
|
||||
*/
|
||||
public function testiTopModulesPhpVersion($sExpectedVersion, $sPhpFile)
|
||||
{
|
||||
|
||||
$sModulePath = realpath($sPhpFile);
|
||||
$sModuleFileName = basename($sModulePath);
|
||||
$sModuleName = preg_replace('/[^.]+\.([^.]+)\.php/', '$1', $sModuleFileName);
|
||||
|
||||
$sFileContent = file_get_contents($sPhpFile);
|
||||
|
||||
preg_match(
|
||||
"#'$sModuleName/([^']+)'#",
|
||||
$sFileContent,
|
||||
$matches
|
||||
);
|
||||
|
||||
$this->assertSame($sExpectedVersion, $matches[1], "$sPhpFile file refer does not refer to current itop version ($matches[1] instead of expected $sExpectedVersion)");
|
||||
}
|
||||
|
||||
public function iTopModulesPhpVersionProvider()
|
||||
{
|
||||
parent::setUp();
|
||||
|
||||
require_once APPROOT.'core/config.class.inc.php';
|
||||
require_once APPROOT.'application/utils.inc.php';
|
||||
|
||||
if (is_dir(APPROOT.'datamodels/2.x'))
|
||||
{
|
||||
$DatamodelsPath = APPROOT.'datamodels/2.x';
|
||||
}
|
||||
elseif (is_dir(APPROOT.'datamodels/1.x'))
|
||||
{
|
||||
$DatamodelsPath = APPROOT.'datamodels/1.x';
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new \Exception('Cannot local the datamodels directory');
|
||||
}
|
||||
|
||||
$sPath = $DatamodelsPath.'/*/module.*.php';
|
||||
$aPhpFiles = glob($sPath);
|
||||
|
||||
$sExpectedVersion = \utils::GetItopPatchVersion();
|
||||
|
||||
$aTestCases = array();
|
||||
foreach ($aPhpFiles as $sPhpFile)
|
||||
{
|
||||
$aTestCases[$sPhpFile] = array(
|
||||
'sExpectedVersion' => $sExpectedVersion,
|
||||
'sPhpFile' => $sPhpFile,
|
||||
);
|
||||
}
|
||||
|
||||
return $aTestCases;
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user