assertRegExp("#$sExpectedVersion#", $matches[1], " $sPhpFile:2 file refer does not refer to current itop version ($sModuleName/$matches[1] does not match regexp $sModuleName/$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::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) { $aTestCases[$sPhpFile] = array( 'sExpectedVersion' => $sExpectedVersion, 'sPhpFile' => $sPhpFile, ); } return $aTestCases; } }