diff --git a/core/lib/Drupal/Core/Extension/InfoParserDynamic.php b/core/lib/Drupal/Core/Extension/InfoParserDynamic.php index d1576da69b..f58a12dfe8 100644 --- a/core/lib/Drupal/Core/Extension/InfoParserDynamic.php +++ b/core/lib/Drupal/Core/Extension/InfoParserDynamic.php @@ -162,8 +162,8 @@ protected static function isConstraintSatisfiedByPreCoreVersionRequirementCoreVe } } } + $evaluated_constraints[$constraint] = FALSE; } - $evaluated_constraints[$constraint] = FALSE; return $evaluated_constraints[$constraint]; } diff --git a/core/tests/Drupal/Tests/Core/Extension/InfoParserUnitTest.php b/core/tests/Drupal/Tests/Core/Extension/InfoParserUnitTest.php index f7f78bc575..2ecd2894be 100644 --- a/core/tests/Drupal/Tests/Core/Extension/InfoParserUnitTest.php +++ b/core/tests/Drupal/Tests/Core/Extension/InfoParserUnitTest.php @@ -3,6 +3,7 @@ namespace Drupal\Tests\Core\Extension; use Drupal\Core\Extension\InfoParser; +use Drupal\Core\Extension\InfoParserException; use Drupal\Tests\UnitTestCase; use org\bovigo\vfs\vfsStream; @@ -243,12 +244,25 @@ public function testCoreVersionRequirementInvalid($file_name, $constraint) { vfsStream::create([ 'fixtures' => [ "$file_name.info.txt" => $invalid_core_version_requirement, + "$file_name-duplicate.info.txt" => $invalid_core_version_requirement, ], ]); - $filename = vfsStream::url("modules/fixtures/$file_name.info.txt"); - $this->expectException('\Drupal\Core\Extension\InfoParserException'); - $this->expectExceptionMessage("The 'core_version_requirement' can not be used to specify compatibility specific version before 8.7.7 in vfs://modules/fixtures/$file_name.info.txt"); - $this->infoParser->parse($filename); + $exception_message = "The 'core_version_requirement' can not be used to specify compatibility specific version before 8.7.7 in vfs://modules/fixtures/"; + try { + $this->infoParser->parse(vfsStream::url("modules/fixtures/$file_name.info.txt")); + } + catch (InfoParserException $exception) { + $this->assertSame($exception_message . "$file_name.info.txt", $exception->getMessage()); + try { + $this->infoParser->parse(vfsStream::url("modules/fixtures/$file_name-duplicate.info.txt")); + } + catch (InfoParserException $exception) { + $this->assertSame($exception_message . "$file_name-duplicate.info.txt", $exception->getMessage()); + return; + } + } + + $this->fail('The exception was not thrown when parsing the info file the second time.'); } /**