You are here

public function InfoParserUnitTest::testCoreIncompatibility 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::testCoreIncompatibility()
  2. 9 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 270

Class

InfoParserUnitTest
Tests InfoParser class and exception.

Namespace

Drupal\Tests\Core\Extension

Code

public function testCoreIncompatibility($test_case, $constraint, $expected) {
  $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}");
  }
}