OverlapWithTopLevelDependenciesTest.php in Drupal 10
File
core/tests/Drupal/Tests/Composer/Generator/OverlapWithTopLevelDependenciesTest.php
View source
<?php
namespace Drupal\Tests\Composer\Generator;
use PHPUnit\Framework\TestCase;
class OverlapWithTopLevelDependenciesTest extends TestCase {
public function templateProjectPathProvider() {
return [
[
'composer/Template/RecommendedProject',
],
[
'composer/Template/LegacyProject',
],
];
}
public function testOverlapWithTemplateProject($template_project_path) {
$root = dirname(__DIR__, 6);
$top_level_composer_json = json_decode(file_get_contents("{$root}/{$template_project_path}/composer.json"), TRUE);
$core_recommended_composer_json = json_decode(file_get_contents("{$root}/composer/Metapackage/CoreRecommended/composer.json"), TRUE);
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");
}
}
}