Issue #3098281 by greg.1.anderson, alexpott, heddn, Mile23, xjm, jungle, longwave: Ensure that 'composer update' evaluates dependencies using the correct PHP version

merge-requests/93/head
catch 2020-11-22 21:22:19 +00:00
parent b63a325edd
commit b7747368ba
4 changed files with 24 additions and 5 deletions

View File

@ -45,7 +45,10 @@
"prefer-stable": true,
"config": {
"preferred-install": "dist",
"autoloader-suffix": "Drupal9"
"autoloader-suffix": "Drupal9",
"platform": {
"php": "7.3.0"
}
},
"extra": {
"_readme": [

9
composer.lock generated
View File

@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically"
],
"content-hash": "1387b767469672675eafc323b5e0b55a",
"content-hash": "825626fa3eb8a72e63e24d96adc6e33b",
"packages": [
{
"name": "asm89/stack-cors",
@ -528,7 +528,7 @@
"dist": {
"type": "path",
"url": "core",
"reference": "af5b9453adf15c6831b1f73e322f8c59da877f14"
"reference": "4659974dafc65cf2e9fbe00c8be0ccd0ef0aadba"
},
"require": {
"asm89/stack-cors": "^1.1",
@ -554,7 +554,7 @@
"laminas/laminas-feed": "^2.12",
"masterminds/html5": "^2.1",
"pear/archive_tar": "^1.4.9",
"php": ">=7.3",
"php": ">=7.3.0",
"psr/log": "^1.0",
"stack/builder": "^1.0",
"symfony-cmf/routing": "^2.1",
@ -7693,5 +7693,8 @@
"prefer-lowest": false,
"platform": [],
"platform-dev": [],
"platform-overrides": {
"php": "7.3.0"
},
"plugin-api-version": "2.0.0"
}

View File

@ -17,7 +17,7 @@
"ext-SPL": "*",
"ext-tokenizer": "*",
"ext-xml": "*",
"php": ">=7.3",
"php": ">=7.3.0",
"symfony/console": "^4.4",
"symfony/dependency-injection": "^4.4",
"symfony/event-dispatcher": "^4.4",

View File

@ -25,4 +25,17 @@ class ComposerTest extends UnitTestCase {
}
}
/**
* Ensure that the configured php version matches the minimum php version.
*
* Also ensure that the minimum php version in the root-level composer.json
* file exactly matches DRUPAL_MINIMUM_PHP.
*/
public function testEnsurePhpConfiguredVersion() {
$composer_json = json_decode(file_get_contents($this->root . '/composer.json'), TRUE);
$composer_core_json = json_decode(file_get_contents($this->root . '/core/composer.json'), TRUE);
$this->assertEquals(DRUPAL_MINIMUM_PHP, $composer_json['config']['platform']['php'], 'The DRUPAL_MINIMUM_PHP constant should always be exactly the same as the config.platform.php in the root composer.json.');
$this->assertEquals($composer_core_json['require']['php'], '>=' . $composer_json['config']['platform']['php'], 'The config.platform.php configured version in the root composer.json file should always be exactly the same as the minimum php version configured in core/composer.json.');
}
}