function InfoParserUnitTest::testInfoParserCoreInfo

Same name in other branches
  1. 9 core/tests/Drupal/Tests/Core/Extension/InfoParserUnitTest.php \Drupal\Tests\Core\Extension\InfoParserUnitTest::testInfoParserCoreInfo()
  2. 8.9.x core/tests/Drupal/Tests/Core/Extension/InfoParserUnitTest.php \Drupal\Tests\Core\Extension\InfoParserUnitTest::testInfoParserCoreInfo()
  3. 11.x core/tests/Drupal/Tests/Core/Extension/InfoParserUnitTest.php \Drupal\Tests\Core\Extension\InfoParserUnitTest::testInfoParserCoreInfo()

Tests common info file.

@covers ::parse

File

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

Class

InfoParserUnitTest
Tests InfoParser class and exception.

Namespace

Drupal\Tests\Core\Extension

Code

public function testInfoParserCoreInfo() : void {
    $common = <<<CORE
name: core_test
type: module
version: "VERSION"
description: 'testing info file parsing'
CORE;
    vfsStream::setup('core');
    $filename = "core_test.info.txt";
    vfsStream::create([
        'fixtures' => [
            $filename => $common,
        ],
    ]);
    $info_values = $this->infoParser
        ->parse(vfsStream::url("core/fixtures/{$filename}"));
    $this->assertEquals(\Drupal::VERSION, $info_values['version'], 'Constant value was parsed correctly.');
    $this->assertFalse($info_values['core_incompatible']);
    $this->assertEquals(\Drupal::VERSION, $info_values['core_version_requirement']);
}

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