You are here

public function InfoParserUnitTest::testInfoParserCoreInfo in Drupal 10

Same name and namespace in other branches
  1. 8 core/tests/Drupal/Tests/Core/Extension/InfoParserUnitTest.php \Drupal\Tests\Core\Extension\InfoParserUnitTest::testInfoParserCoreInfo()
  2. 9 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 243

Class

InfoParserUnitTest
Tests InfoParser class and exception.

Namespace

Drupal\Tests\Core\Extension

Code

public function testInfoParserCoreInfo() {
  $common = <<<CORETEST
name: core_test
type: module
version: "VERSION"
description: 'testing info file parsing'
CORETEST;
  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']);
}