diff --git a/core/lib/Drupal/Core/Extension/InfoParserDynamic.php b/core/lib/Drupal/Core/Extension/InfoParserDynamic.php index 43a2c85176..e83831e8e0 100644 --- a/core/lib/Drupal/Core/Extension/InfoParserDynamic.php +++ b/core/lib/Drupal/Core/Extension/InfoParserDynamic.php @@ -110,6 +110,8 @@ public function parse($filename) { // Non-core extensions must specify core compatibility. throw new InfoParserException("If the 'core' or 'core_version_requirement' key is not provided a composer.json file is required in $filename"); } + } + if (file_exists($composer_filename)) { $parsed_info += $this->parseComposerFile($composer_filename); } diff --git a/core/modules/system/tests/modules/composer_core_incompatible_test/composer.json b/core/modules/system/tests/modules/composer_core_incompatible_test/composer.json index 985a012569..a3cb33ff03 100644 --- a/core/modules/system/tests/modules/composer_core_incompatible_test/composer.json +++ b/core/modules/system/tests/modules/composer_core_incompatible_test/composer.json @@ -1,5 +1,7 @@ { "name": "drupal/composer_core_incompatible_test", + "description": "A test composer file", + "license": "GPL-2.0-or-later", "type": "drupal-module", "require": { "drupal/core": "^100" diff --git a/core/modules/system/tests/modules/composer_dependencies_test/composer.json b/core/modules/system/tests/modules/composer_dependencies_test/composer.json index d23f00a4e7..ec9d6ff0f7 100644 --- a/core/modules/system/tests/modules/composer_dependencies_test/composer.json +++ b/core/modules/system/tests/modules/composer_dependencies_test/composer.json @@ -1,5 +1,7 @@ { "name": "drupal/composer_dependencies_test", + "description": "A test composer file", + "license": "GPL-2.0-or-later", "type": "drupal-module", "require": { "drupal/core": "^8.8", diff --git a/core/modules/system/tests/modules/composer_incompatible_core_composer_depend_test/composer.json b/core/modules/system/tests/modules/composer_incompatible_core_composer_depend_test/composer.json index 8c32cc7a87..07581995b7 100644 --- a/core/modules/system/tests/modules/composer_incompatible_core_composer_depend_test/composer.json +++ b/core/modules/system/tests/modules/composer_incompatible_core_composer_depend_test/composer.json @@ -1,5 +1,7 @@ { "name": "drupal/composer_incompatible_core_composer_depend_test", + "description": "A test composer file", + "license": "GPL-2.0-or-later", "type": "drupal-module", "require": { "drupal/core": "^8.8", diff --git a/core/modules/system/tests/modules/composer_incompatible_core_depend_test/composer.json b/core/modules/system/tests/modules/composer_incompatible_core_depend_test/composer.json index 6b8a4532a6..237b5af5e5 100644 --- a/core/modules/system/tests/modules/composer_incompatible_core_depend_test/composer.json +++ b/core/modules/system/tests/modules/composer_incompatible_core_depend_test/composer.json @@ -1,5 +1,7 @@ { "name": "drupal/composer_incompatible_core_depend_test", + "description": "A test composer file", + "license": "GPL-2.0-or-later", "type": "drupal-module", "require": { "drupal/core": "^8.8", diff --git a/core/modules/system/tests/modules/composer_incompatible_module_version_dependencies_test/composer.json b/core/modules/system/tests/modules/composer_incompatible_module_version_dependencies_test/composer.json index a04dbb51d5..875dfef22c 100644 --- a/core/modules/system/tests/modules/composer_incompatible_module_version_dependencies_test/composer.json +++ b/core/modules/system/tests/modules/composer_incompatible_module_version_dependencies_test/composer.json @@ -1,5 +1,7 @@ { "name": "drupal/composer_incompatible_module_version_dependencies_test", + "description": "A test composer file", + "license": "GPL-2.0-or-later", "type": "drupal-module", "require": { "drupal/core": "^8.8", diff --git a/core/modules/system/tests/modules/system_composer_dependencies_test/composer.json b/core/modules/system/tests/modules/system_composer_dependencies_test/composer.json index b273b741a1..abc9de2db0 100644 --- a/core/modules/system/tests/modules/system_composer_dependencies_test/composer.json +++ b/core/modules/system/tests/modules/system_composer_dependencies_test/composer.json @@ -1,6 +1,7 @@ { "name": "drupal/system_composer_dependencies_test", "description": "Support module for testing system composer dependencies.", + "license": "GPL-2.0-or-later", "type": "drupal-module", "require": { "drupal/core": "^8.8", diff --git a/core/modules/system/tests/modules/system_core_composer_test/composer.json b/core/modules/system/tests/modules/system_core_composer_test/composer.json index a6d34d7743..63b42db1fc 100644 --- a/core/modules/system/tests/modules/system_core_composer_test/composer.json +++ b/core/modules/system/tests/modules/system_core_composer_test/composer.json @@ -1,5 +1,7 @@ { "name": "drupal/system_core_composer_test", + "description": "A test composer file", + "license": "GPL-2.0-or-later", "type": "drupal-module", "require": { "drupal/core": "^8.8 || ^9 || ^10 || ^11 || ^12 || ^13" diff --git a/core/tests/Drupal/Tests/Core/Extension/InfoParserUnitTest.php b/core/tests/Drupal/Tests/Core/Extension/InfoParserUnitTest.php index 43d6b63b17..7307b7e1c1 100644 --- a/core/tests/Drupal/Tests/Core/Extension/InfoParserUnitTest.php +++ b/core/tests/Drupal/Tests/Core/Extension/InfoParserUnitTest.php @@ -581,6 +581,59 @@ public function testComposerJson() { } + /** + * Tests a composer.json file with module in 'Testing' package. + * + * @covers ::parse + */ + public function testComposerJsonTestPackage() { + $common_info = << [ + 'common_no_dependencies_test.info.yml' => $common_info, + 'composer.json' => $common_json, + ], + ]); + $info_values = $this->infoParser->parse(vfsStream::url("modules/$folder/common_no_dependencies_test.info.yml")); + $this->assertEquals('A simple string', $info_values['simple_string']); + $this->assertEquals(\Drupal::VERSION, $info_values['version']); + $this->assertEquals('Common test', $info_values['name']); + $this->assertFalse(isset($info_values['dependencies'])); + $this->assertSame(['field' => '~8.0'], $info_values[InfoParserDynamic::COMPOSER_DEPENDENCIES]); + $this->assertSame(\Drupal::VERSION, $info_values['core_version_requirement']); + $this->assertFalse(isset($info_values['core'])); + $this->assertEquals('module', $info_values['type']); + } + + } + /** * Tests a composer.json file with invalid 'drupal/core' value. *