You are here

public function InfoParserUnitTest::testInfoParserCommonInfo in Zircon Profile 8.0

Same name and namespace in other branches
  1. 8 core/tests/Drupal/Tests/Core/Extension/InfoParserUnitTest.php \Drupal\Tests\Core\Extension\InfoParserUnitTest::testInfoParserCommonInfo()

Tests common info file.

@covers ::parse

File

core/tests/Drupal/Tests/Core/Extension/InfoParserUnitTest.php, line 147
Contains \Drupal\Tests\Core\Extension\InfoParserUnitTest.

Class

InfoParserUnitTest
Tests InfoParser class and exception.

Namespace

Drupal\Tests\Core\Extension

Code

public function testInfoParserCommonInfo() {
  $common = <<<COMMONTEST
core: 8.x
name: common_test
type: module
description: 'testing info file parsing'
simple_string: 'A simple string'
version: "VERSION"
double_colon: dummyClassName::
COMMONTEST;
  vfsStream::setup('modules');
  vfsStream::create([
    'fixtures' => [
      'common_test.info.txt' => $common,
    ],
  ]);
  $info_values = $this->infoParser
    ->parse(vfsStream::url('modules/fixtures/common_test.info.txt'));
  $this
    ->assertEquals($info_values['simple_string'], 'A simple string', 'Simple string value was parsed correctly.');
  $this
    ->assertEquals($info_values['version'], \Drupal::VERSION, 'Constant value was parsed correctly.');
  $this
    ->assertEquals($info_values['double_colon'], 'dummyClassName::', 'Value containing double-colon was parsed correctly.');
}