You are here

public function InfoParserUnitTest::testInfoParserCoreInfo in Drupal 8

Same name and namespace in other branches
  1. 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 406

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($info_values['version'], \Drupal::VERSION, 'Constant value was parsed correctly.');
  $this
    ->assertFalse($info_values['core_incompatible']);
  $this
    ->assertEquals(\Drupal::VERSION, $info_values['core_version_requirement']);
}