Commit 98475425 authored by catch's avatar catch

Issue #3134648 by alexpott, dww, greg.1.anderson, hussainweb, catch, xjm:...

Issue #3134648 by alexpott, dww, greg.1.anderson, hussainweb, catch, xjm: Don't pin the composer/installers version in drupal/core-recommended
parent 421c588c
......@@ -30,7 +30,7 @@ public function getPackage() {
}
// Make a list of packages we do not want to put in the 'require' section.
$remove_list = ['drupal/core', 'wikimedia/composer-merge-plugin'];
$remove_list = ['drupal/core', 'wikimedia/composer-merge-plugin', 'composer/installers'];
// Copy the 'packages' section from the Composer lock into our 'require'
// section. There is also a 'packages-dev' section, but we do not need
......
......@@ -9,7 +9,6 @@
"require": {
"drupal/core": "9.1.x-dev",
"asm89/stack-cors": "1.3.0",
"composer/installers": "v1.9.0",
"composer/semver": "1.5.1",
"doctrine/annotations": "1.10.2",
"doctrine/lexer": "1.2.0",
......
......@@ -33,6 +33,7 @@ protected function composerJson() {
'license' => 'GPL-2.0-or-later',
'require' =>
[
'composer/installers' => '^1.9',
'php' => '>=7.0.8',
'symfony/yaml' => '~3.4.5',
],
......@@ -59,6 +60,15 @@ protected function composerLock() {
'content-hash' => 'da9910627bab73a256b39ceda83d7167',
'packages' =>
[
[
'name' => "composer/installers",
'version' => 'v1.9.0',
'source' => [
'type' => 'git',
'url' => 'https://github.com/composer/installers.git',
'reference' => 'b93bcf0fa1fccb0b7d176b0967d969691cd74cca',
],
],
[
'name' => 'symfony/polyfill-ctype',
'version' => 'v1.12.0',
......
<?php
namespace Drupal\Tests\Composer\Generator;
use PHPUnit\Framework\TestCase;
/**
* Tests DrupalCoreRecommendedBuilder.
*
* @group Metapackage
*/
class OverlapWithTopLevelDependenciesTest extends TestCase {
/**
* Provides data for testOverlapWithTemplateProject().
*/
public function templateProjectPathProvider() {
return [
[
'composer/Template/RecommendedProject',
],
[
'composer/Template/LegacyProject',
],
];
}
/**
* Tests top level and core-recommended dependencies do not overlap.
*
* @dataProvider templateProjectPathProvider
*
* @param string $template_project_path
* The path of the project template to test.
*/
public function testOverlapWithTemplateProject($template_project_path) {
$root = dirname(__DIR__, 6);
// Read template project composer.json.
$top_level_composer_json = json_decode(file_get_contents("$root/$template_project_path/composer.json"), TRUE);
// Read drupal/core-recommended composer.json.
$core_recommended_composer_json = json_decode(file_get_contents("$root/composer/Metapackage/CoreRecommended/composer.json"), TRUE);
// Fail if any required project in the require section of the template
// project also exists in core/recommended.
foreach ($top_level_composer_json['require'] as $project => $version_constraint) {
$this->assertArrayNotHasKey($project, $core_recommended_composer_json['require'], "Pinned project $project is also a top-level dependency of $template_project_path. This can expose a Composer bug. See https://www.drupal.org/project/drupal/issues/3134648 and https://github.com/composer/composer/issues/8882");
}
}
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment