Verified Commit 98deec06 authored by alexpott's avatar alexpott
Browse files

Issue #3116405 by Spokje, Mile23, Hardik_Patel_12, jofitz, Sahana _N,...

Issue #3116405 by Spokje, Mile23, Hardik_Patel_12, jofitz, Sahana _N, andypost, alexpott, fgm: Warnings generated when using an optimized autoload file with Composer 1.10 / Composer 2
parent 1600b7ab
......@@ -526,7 +526,7 @@
"dist": {
"type": "path",
"url": "core",
"reference": "4b2f5a5526e42fa659fef4ea608b5984d50d95f6"
"reference": "b5409bf7e4edd0ae372e8bfe1f3d73677b68b59e"
},
"require": {
"asm89/stack-cors": "^1.3",
......@@ -578,6 +578,33 @@
"drush/drush": "<8.1.10",
"symfony/http-foundation": "4.4.42"
},
"replace": {
"drupal/core-annotation": "self.version",
"drupal/core-assertion": "self.version",
"drupal/core-bridge": "self.version",
"drupal/core-class-finder": "self.version",
"drupal/core-datetime": "self.version",
"drupal/core-dependency-injection": "self.version",
"drupal/core-diff": "self.version",
"drupal/core-discovery": "self.version",
"drupal/core-event-dispatcher": "self.version",
"drupal/core-file-cache": "self.version",
"drupal/core-file-security": "self.version",
"drupal/core-filesystem": "self.version",
"drupal/core-front-matter": "self.version",
"drupal/core-gettext": "self.version",
"drupal/core-graph": "self.version",
"drupal/core-http-foundation": "self.version",
"drupal/core-php-storage": "self.version",
"drupal/core-plugin": "self.version",
"drupal/core-proxy-builder": "self.version",
"drupal/core-render": "self.version",
"drupal/core-serialization": "self.version",
"drupal/core-transliteration": "self.version",
"drupal/core-utility": "self.version",
"drupal/core-uuid": "self.version",
"drupal/core-version": "self.version"
},
"type": "drupal-core",
"extra": {
"drupal-scaffold": {
......
......@@ -53,6 +53,33 @@
"drush/drush": "<8.1.10",
"symfony/http-foundation": "4.4.42"
},
"replace": {
"drupal/core-annotation": "self.version",
"drupal/core-assertion": "self.version",
"drupal/core-bridge": "self.version",
"drupal/core-class-finder": "self.version",
"drupal/core-datetime": "self.version",
"drupal/core-dependency-injection": "self.version",
"drupal/core-diff": "self.version",
"drupal/core-discovery": "self.version",
"drupal/core-event-dispatcher": "self.version",
"drupal/core-file-cache": "self.version",
"drupal/core-file-security": "self.version",
"drupal/core-filesystem": "self.version",
"drupal/core-front-matter": "self.version",
"drupal/core-gettext": "self.version",
"drupal/core-graph": "self.version",
"drupal/core-http-foundation": "self.version",
"drupal/core-php-storage": "self.version",
"drupal/core-plugin": "self.version",
"drupal/core-proxy-builder": "self.version",
"drupal/core-render": "self.version",
"drupal/core-serialization": "self.version",
"drupal/core-transliteration": "self.version",
"drupal/core-utility": "self.version",
"drupal/core-uuid": "self.version",
"drupal/core-version": "self.version"
},
"minimum-stability": "dev",
"prefer-stable": true,
"autoload": {
......
......@@ -6,6 +6,7 @@
use Drupal\Core\Composer\Composer;
use Drupal\Tests\Composer\ComposerIntegrationTrait;
use Drupal\TestTools\PhpUnitCompatibility\RunnerVersion;
use Symfony\Component\Finder\Finder;
/**
* Tests Composer integration.
......@@ -86,6 +87,49 @@ public function providerTestComposerJson() {
return $data;
}
/**
* Tests core's composer.json replace section.
*
* Verify that all core components are also listed in the 'replace' section of
* core's composer.json.
*/
public function testAllCoreComponentsReplaced(): void {
// Assemble a path to core components.
$components_path = $this->root . '/core/lib/Drupal/Component';
// Grab the 'replace' section of the core composer.json file.
$json = json_decode(file_get_contents($this->root . '/core/composer.json'), FALSE);
$composer_replace_packages = (array) $json->replace;
// Get a list of all the composer.json files in the components path.
$components_composer_json_files = [];
$composer_json_finder = new Finder();
$composer_json_finder->name('composer.json')
->in($components_path)
->ignoreUnreadableDirs();
foreach ($composer_json_finder->getIterator() as $composer_json) {
$components_composer_json_files[$composer_json->getPathname()] = [$composer_json->getPathname()];
}
$this->assertNotEmpty($components_composer_json_files);
$this->assertCount(count($composer_replace_packages), $components_composer_json_files);
// Assert that each core components has a corresponding 'replace' in
// composer.json.
foreach ($components_composer_json_files as $components_composer_json_file) {
$json = json_decode(file_get_contents(reset($components_composer_json_file)), FALSE);
$component_name = $json->name;
$this->assertArrayHasKey(
$component_name,
$composer_replace_packages,
'Unable to find ' . $component_name . ' in replace list of composer.json'
);
}
}
/**
* Data provider for the scaffold files test for Drupal core.
*
......
Supports Markdown
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