public function InfoParserUnitTest::testCoreCoreVersionRequirement88 in Drupal 8
Same name and namespace in other branches
- 9 core/tests/Drupal/Tests/Core/Extension/InfoParserUnitTest.php \Drupal\Tests\Core\Extension\InfoParserUnitTest::testCoreCoreVersionRequirement88()
Tests that 'core_version_requirement: ^8.8' is invalid with a 'core' key.
@covers ::parse
File
- core/
tests/ Drupal/ Tests/ Core/ Extension/ InfoParserUnitTest.php, line 202
Class
- InfoParserUnitTest
- Tests InfoParser class and exception.
Namespace
Drupal\Tests\Core\ExtensionCode
public function testCoreCoreVersionRequirement88() {
$core_and_core_version_requirement_88 = <<<BOTH_CORE_CORE_VERSION_REQUIREMENT_88
# info.yml for testing core and core_version_requirement keys.
package: Core
core: 8.x
core_version_requirement: ^8.8
version: VERSION
type: module
name: Form auto submitter
dependencies:
- field
BOTH_CORE_CORE_VERSION_REQUIREMENT_88;
vfsStream::setup('modules');
vfsStream::create([
'fixtures' => [
'core_and_core_version_requirement_88.info.txt' => $core_and_core_version_requirement_88,
'core_and_core_version_requirement_88-duplicate.info.txt' => $core_and_core_version_requirement_88,
],
]);
$exception_message = "The 'core_version_requirement' constraint (^8.8) requires the 'core' key not be set in vfs://modules/fixtures/core_and_core_version_requirement_88";
// Set the expected exception for the 2nd call to parse().
$this
->expectException('\\Drupal\\Core\\Extension\\InfoParserException');
$this
->expectExceptionMessage("{$exception_message}-duplicate.info.txt");
try {
$this->infoParser
->parse(vfsStream::url('modules/fixtures/core_and_core_version_requirement_88.info.txt'));
} catch (InfoParserException $exception) {
$this
->assertSame("{$exception_message}.info.txt", $exception
->getMessage());
$this->infoParser
->parse(vfsStream::url('modules/fixtures/core_and_core_version_requirement_88-duplicate.info.txt'));
}
}