You are here

public function InfoParserUnitTest::testCore8x in Drupal 9

Tests a 'core: 8.x' with different values for 'core_version_requirement'.

@covers ::parse

@dataProvider providerCore8x

File

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

Class

InfoParserUnitTest
Tests InfoParser class and exception.

Namespace

Drupal\Tests\Core\Extension

Code

public function testCore8x($core_version_requirement, $filename) {
  $core_8x = <<<CORE_8X
package: Tests
core: 8.x
core_version_requirement: '{<span class="php-variable">$core_version_requirement</span>}'
version: VERSION
type: module
name: Yet another test module
description: Sorry, I am running out of witty descriptions
CORE_8X;
  vfsStream::setup('modules');
  vfsStream::create([
    'fixtures' => [
      "core_8x-{$filename}.info.txt" => $core_8x,
      "core_8x-{$filename}-duplicate.info.txt" => $core_8x,
    ],
  ]);
  $parsed = $this->infoParser
    ->parse(vfsStream::url("modules/fixtures/core_8x-{$filename}.info.txt"));
  $this
    ->assertSame($core_version_requirement, $parsed['core_version_requirement']);
  $this->infoParser
    ->parse(vfsStream::url("modules/fixtures/core_8x-{$filename}-duplicate.info.txt"));
  $this
    ->assertSame($core_version_requirement, $parsed['core_version_requirement']);
}