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
No related branches found
No related tags found
No related merge requests found
......@@ -77,7 +77,12 @@ public function parse($filename) {
throw new InfoParserException("Invalid 'core' value \"{$parsed_info['core']}\" in " . $filename);
}
if (isset($parsed_info['core_version_requirement'])) {
$supports_pre_core_version_requirement_version = static::isConstraintSatisfiedByPreviousVersion($parsed_info['core_version_requirement'], static::FIRST_CORE_VERSION_REQUIREMENT_SUPPORTED_VERSION);
try {
$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
// Drupal 8 versions before 8.7.7 then 'core' cannot be set or it will
// effectively support all versions of Drupal 8 because
......
......@@ -529,8 +529,8 @@ public function testUnparsableCoreVersionRequirement() {
'unparsable_core_version_requirement.info.txt' => $unparsable_core_version_requirement,
],
]);
$this->expectException(\UnexpectedValueException::class);
$this->expectExceptionMessage('Could not parse version constraint not-this-version: Invalid version string "not-this-version"');
$this->expectException(InfoParserException::class);
$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'));
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment