function InfoParserUnitTest::testCoreVersionRequirement88

Same name in other branches
  1. 8.9.x core/tests/Drupal/Tests/Core/Extension/InfoParserUnitTest.php \Drupal\Tests\Core\Extension\InfoParserUnitTest::testCoreVersionRequirement88()

Tests that 'core_version_requirement: ^8.8' is valid with no 'core' key.

@covers ::parse

File

core/tests/Drupal/Tests/Core/Extension/InfoParserUnitTest.php, line 173

Class

InfoParserUnitTest
Tests InfoParser class and exception.

Namespace

Drupal\Tests\Core\Extension

Code

public function testCoreVersionRequirement88() {
    $core_version_requirement = <<<BOTH_CORE_VERSION_REQUIREMENT
# info.yml for testing core and core_version_requirement keys.
package: Core
core_version_requirement: ^8.8
version: VERSION
type: module
name: Module for That
dependencies:
  - field
BOTH_CORE_VERSION_REQUIREMENT;
    vfsStream::setup('modules');
    foreach ([
        '1',
        '2',
    ] as $file_delta) {
        $filename = "core_version_requirement-{$file_delta}.info.txt";
        vfsStream::create([
            'fixtures' => [
                $filename => $core_version_requirement,
            ],
        ]);
        $info_values = $this->infoParser
            ->parse(vfsStream::url("modules/fixtures/{$filename}"));
        $this->assertSame($info_values['core_version_requirement'], '^8.8', "Expected core_version_requirement for file: {$filename}");
    }
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.