* */ namespace Combodo\iTop\Test\UnitTest\ReleaseChecklist; use Combodo\iTop\Test\UnitTest\ItopTestCase; use DOMDocument; use iTopDesignFormat; /** * Class iTopDesignFormatChecklistTest * * @runTestsInSeparateProcesses * @preserveGlobalState disabled * @backupGlobals disabled * * @covers iTopDesignFormat * * @package Combodo\iTop\Test\UnitTest\Setup */ class iTopModulesPhpVersionChecklistTest extends ItopTestCase { /** * Verify if the datamodel.*.xml files refer to the current itop version * This is part of the checklist tests. * * @dataProvider DatamodelItopXmlVersionProvider */ public function testDatamodelItopXmlVersion($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]); } public function DatamodelItopXmlVersionProvider() { parent::setUp(); require_once APPROOT.'core/config.class.inc.php'; require_once APPROOT.'application/utils.inc.php'; $sPath = APPROOT.'datamodels/2.x/*/module.*.php'; $aPhpFiles = glob($sPath); $sExpectedVersion = \utils::GetItopVersionShort(); $aTestCases = array(); foreach ($aPhpFiles as $sPhpFile) { $aTestCases[$sPhpFile] = array( 'sExpectedVersion' => $sExpectedVersion, 'sPhpFile' => $sPhpFile, ); } return $aTestCases; } }