Merge remote-tracking branch 'origin/support/2.7' into support/3.0

# Conflicts:
#	test/integration/iTopModulesPhpVersionChecklistTest.php
This commit is contained in:
Pierre Goiffon
2022-02-08 14:49:08 +01:00
2 changed files with 31 additions and 3 deletions

View File

@@ -2408,11 +2408,11 @@ class utils
* @throws \ApplicationException if constant value is invalid
* @uses ITOP_CORE_VERSION
*/
public static function GetCoreVersionWikiSyntax()
public static function GetCoreVersionWikiSyntax($sItopVersion = ITOP_CORE_VERSION)
{
$aExplodedVersion = explode('.', ITOP_CORE_VERSION);
$aExplodedVersion = explode('.', $sItopVersion);
if (empty($aExplodedVersion[0]) || empty($aExplodedVersion[1])) {
if ((false === isset($aExplodedVersion[0])) || (false === isset($aExplodedVersion[1]))) {
throw new ApplicationException('iTop version is wrongfully configured!');
}

View File

@@ -15,7 +15,9 @@
namespace Combodo\iTop\Test\UnitTest\Integration;
use ApplicationException;
use Combodo\iTop\Test\UnitTest\ItopTestCase;
use utils;
/**
@@ -79,4 +81,30 @@ class iTopModulesPhpVersionIntegrationTest extends ItopTestCase {
self::assertEquals([], $aModuleWithError, 'Some modules have wrong versions ! They should match '.$sExpectedVersion);
}
/**
* @dataProvider ItopWikiVersionProvider
* @since 2.7.7 3.0.1 3.1.1 N°4714 new ITOP_CORE_VERSION constant
*/
public function testItopWikiVersion($sItopVersion, $sExpectedWikiVersion) {
try {
$sActualWikiVersion = utils::GetCoreVersionWikiSyntax($sItopVersion);
}
catch (ApplicationException $e) {
self::fail('Cannot get wiki version : '.$e->getMessage());
}
self::assertSame($sExpectedWikiVersion, $sActualWikiVersion, 'Computed wiki version is wrong !');
}
public function ItopWikiVersionProvider()
{
return [
['2.7.0', '2_7_0'],
['2.7.7', '2_7_0'],
['3.0.0', '3_0_0'],
['3.0.1', '3_0_0'],
['3.1.0', '3_1_0'],
['3.1.1', '3_1_0'],
];
}
}