diff --git a/composer.json b/composer.json index 4ef79ac45..ef4622d89 100644 --- a/composer.json +++ b/composer.json @@ -2,7 +2,7 @@ "type": "project", "license": "AGPLv3", "require": { - "php": ">=7.1.3", + "php": ">=7.1.3 <8.0.0", "ext-ctype": "*", "ext-dom": "*", "ext-gd": "*", diff --git a/test/setup/SetupUtilsTest.php b/test/setup/SetupUtilsTest.php index 76b22859c..053520eef 100644 --- a/test/setup/SetupUtilsTest.php +++ b/test/setup/SetupUtilsTest.php @@ -121,4 +121,24 @@ class SetupUtilsTest extends ItopTestCase ], ]; } + + /** + * @covers SetupUtils::PHP_MIN_VERSION + * @covers SetupUtils::PHP_NOT_VALIDATED_VERSION + * @covers composer.json + */ + public function testPhpMinVersionConsistency() + { + $sPHPMinVersion = SetupUtils::PHP_MIN_VERSION; + $sPHPNotValidatedVersion = SetupUtils::PHP_NOT_VALIDATED_VERSION; + + // 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"); + } }