Skip to content
Snippets Groups Projects
Commit 5b4e237d authored by catch's avatar catch
Browse files

Issue #3088081 by alexpott, dww, tedbow, xjm: Improve the error message if a...

Issue #3088081 by alexpott, dww, tedbow, xjm: Improve the error message if a nonsense constraint is used in core_version_requirement

(cherry picked from commit 1b676519)
parent e90d1054
Branches
Tags
No related merge requests found
...@@ -77,7 +77,12 @@ public function parse($filename) { ...@@ -77,7 +77,12 @@ public function parse($filename) {
throw new InfoParserException("Invalid 'core' value \"{$parsed_info['core']}\" in " . $filename); throw new InfoParserException("Invalid 'core' value \"{$parsed_info['core']}\" in " . $filename);
} }
if (isset($parsed_info['core_version_requirement'])) { if (isset($parsed_info['core_version_requirement'])) {
try {
$supports_pre_core_version_requirement_version = static::isConstraintSatisfiedByPreviousVersion($parsed_info['core_version_requirement'], static::FIRST_CORE_VERSION_REQUIREMENT_SUPPORTED_VERSION); $supports_pre_core_version_requirement_version = static::isConstraintSatisfiedByPreviousVersion($parsed_info['core_version_requirement'], static::FIRST_CORE_VERSION_REQUIREMENT_SUPPORTED_VERSION);
}
catch (\UnexpectedValueException $e) {
throw new InfoParserException("The 'core_version_requirement' constraint ({$parsed_info['core_version_requirement']}) is not a valid value in $filename");
}
// If the 'core_version_requirement' constraint does not satisfy any // If the 'core_version_requirement' constraint does not satisfy any
// Drupal 8 versions before 8.7.7 then 'core' cannot be set or it will // Drupal 8 versions before 8.7.7 then 'core' cannot be set or it will
// effectively support all versions of Drupal 8 because // effectively support all versions of Drupal 8 because
......
...@@ -529,8 +529,8 @@ public function testUnparsableCoreVersionRequirement() { ...@@ -529,8 +529,8 @@ public function testUnparsableCoreVersionRequirement() {
'unparsable_core_version_requirement.info.txt' => $unparsable_core_version_requirement, 'unparsable_core_version_requirement.info.txt' => $unparsable_core_version_requirement,
], ],
]); ]);
$this->expectException(\UnexpectedValueException::class); $this->expectException(InfoParserException::class);
$this->expectExceptionMessage('Could not parse version constraint not-this-version: Invalid version string "not-this-version"'); $this->expectExceptionMessage("The 'core_version_requirement' constraint (not-this-version) is not a valid value in vfs://modules/fixtures/unparsable_core_version_requirement.info.txt");
$this->infoParser->parse(vfsStream::url('modules/fixtures/unparsable_core_version_requirement.info.txt')); $this->infoParser->parse(vfsStream::url('modules/fixtures/unparsable_core_version_requirement.info.txt'));
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment