N°4714 Fix iTopModulesPhpVersionIntegrationTest

Was still testing removed utils::GetItopMinorVersion()
And also wrong merge done in testITopModulesPhpVersion()
This commit is contained in:
Pierre Goiffon
2022-02-08 14:23:09 +01:00
parent 923c3a27a3
commit 94a2421186

View File

@@ -24,30 +24,6 @@ use Combodo\iTop\Test\UnitTest\ItopTestCase;
* @package Combodo\iTop\Test\UnitTest\Setup
*/
class iTopModulesPhpVersionIntegrationTest extends ItopTestCase {
/**
* We had a problem when version was switched from 2.8.0 to 3.0.0, so this test aims to detect such problems
*
* @param string $sVersion
* @param string $sExpectedMinVersion if null the test will expects an exception to occur
*
* @throws \Exception
* @since 3.0.0
* @dataProvider GetItopMinorVersionProvider
*/
public function testGetItopMinorVersion($sVersion, $sExpectedMinVersion) {
if (is_null($sExpectedMinVersion)) {
$this->expectException(\Exception::class);
}
$sActualMinVersion = \utils::GetItopMinorVersion($sVersion);
if (!is_null($sExpectedMinVersion)) {
$this->assertEquals($sExpectedMinVersion, $sActualMinVersion);
}
}
public function GetItopMinorVersionProvider() {
return [['2.8.0', '2.8'], ['3.0.0', '3.0'], ['3.', null], ['3', null]];
}
/**
* @param string $sPhpFile iTop module file
*
@@ -97,9 +73,8 @@ class iTopModulesPhpVersionIntegrationTest extends ItopTestCase {
foreach ($aPhpFiles as $sPhpFile) {
$sActualVersion = $this->GetItopModuleVersion($sPhpFile);
if (!preg_match($sExpectedVersion, $sActualVersion)) {
$aModuleWithError[$sPhpFile] = $sActualVersion;
}
$this->assertSame($sExpectedVersion, $sActualVersion,
'Module desc file does not contain the same version as the core: '.$sPhpFile);
}
self::assertEquals([], $aModuleWithError, 'Some modules have wrong versions ! They should match '.$sExpectedVersion);