-
Notifications
You must be signed in to change notification settings - Fork 53
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Issue #3134648 by alexpott, dww, greg.1.anderson, hussainweb, catch, …
…xjm, Mixologic: [backport, needs scheduling] Don't pin the composer/installers version in drupal/core-recommended
- Loading branch information
Showing
2 changed files
with
61 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
51 changes: 51 additions & 0 deletions
51
tests/Drupal/Tests/Composer/Generator/OverlapWithTopLevelDependenciesTest.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
<?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"); | ||
} | ||
} | ||
|
||
} |