function InfoParserUnitTest::testFloatLikeVersion

Tests a version string that looks like a float.

@legacy-covers ::parse

File

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

Class

InfoParserUnitTest
Tests InfoParser class and exception.

Namespace

Drupal\Tests\Core\Extension

Code

public function testFloatLikeVersion() : void {
  $float_like_version = <<<VERSION_TEST
  core_version_requirement: '*'
  name: 'Float-like version'
  type: module
  version: '1.0'
  VERSION_TEST;
  vfsStream::setup('modules');
  vfsStream::create([
    'fixtures' => [
      'float_like_version.info.txt' => $float_like_version,
    ],
  ]);
  $info_values = $this->infoParser
    ->parse(vfsStream::url('modules/fixtures/float_like_version.info.txt'));
  $this->assertSame('1.0', $info_values['version'], 'Version that looks like a float should be a string');
}

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