function InfoParserUnitTest::testCoreIncompatibility

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

@covers ::parse

@dataProvider providerCoreIncompatibility

File

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

Class

InfoParserUnitTest
Tests InfoParser class and exception.

Namespace

Drupal\Tests\Core\Extension

Code

public function testCoreIncompatibility($test_case, $constraint, $expected) : void {
  $core_incompatibility = <<<CORE_INCOMPATIBILITY
core_version_requirement: {<span class="php-variable">$constraint</span>}
name: common_test
type: module
description: 'testing info file parsing'
simple_string: 'A simple string'
version: "VERSION"
double_colon: dummyClassName::method
CORE_INCOMPATIBILITY;
  vfsStream::setup('modules');
  foreach ([
    '1',
    '2',
  ] as $file_delta) {
    $filename = "core_incompatible-{$test_case}-{$file_delta}.info.txt";
    vfsStream::create([
      'fixtures' => [
        $filename => $core_incompatibility,
      ],
    ]);
    $info_values = $this->infoParser
      ->parse(vfsStream::url("modules/fixtures/{$filename}"));
    $this->assertSame($expected, $info_values['core_incompatible'], "core_incompatible correct in file: {$filename}");
  }
}

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