Fix tests on packages missing composer.json file

This commit is contained in:
Eric Espie
2021-11-03 11:31:43 +01:00
parent 04f7660267
commit 79c17970f8

View File

@@ -136,10 +136,12 @@ class SetupUtilsTest extends ItopTestCase
// Ensure that not validated version is greater than min. supported version
$this->assertTrue(version_compare($sPHPMinVersion, $sPHPNotValidatedVersion, '<'), "SetupUtils::PHP_MIN_VERSION ($sPHPMinVersion) is not strictly lower than SetupUtils::PHP_NOT_VALIDATED_VERSION ($sPHPNotValidatedVersion)");
$oComposerConfig = json_decode(file_get_contents(APPROOT.'composer.json'));
// Platform/PHP must be set to the minimum to ensure dependancies are compatible with the min. version
$this->assertEquals($sPHPMinVersion, $oComposerConfig->config->platform->php, "Composer/Platform/PHP");
// Require/PHP must be set to the supported PHP versions range in order to keep our package constraints up-to-date
$this->assertEquals(">=$sPHPMinVersion <$sPHPNotValidatedVersion", $oComposerConfig->require->php, "Composer/Require/PHP");
if (file_exists(APPROOT.'composer.json')) {
$oComposerConfig = json_decode(file_get_contents(APPROOT.'composer.json'));
// Platform/PHP must be set to the minimum to ensure dependancies are compatible with the min. version
$this->assertEquals($sPHPMinVersion, $oComposerConfig->config->platform->php, "Composer/Platform/PHP");
// Require/PHP must be set to the supported PHP versions range in order to keep our package constraints up-to-date
$this->assertEquals(">=$sPHPMinVersion <$sPHPNotValidatedVersion", $oComposerConfig->require->php, "Composer/Require/PHP");
}
}
}