function InfoParserUnitTest::testFloatVersion
Same name and namespace in other branches
- main core/tests/Drupal/Tests/Core/Extension/InfoParserUnitTest.php \Drupal\Tests\Core\Extension\InfoParserUnitTest::testFloatVersion()
Tests a version string that is a float.
@legacy-covers ::parse
Attributes
#[IgnoreDeprecations]
File
-
core/
tests/ Drupal/ Tests/ Core/ Extension/ InfoParserUnitTest.php, line 220
Class
- InfoParserUnitTest
- Tests InfoParser class and exception.
Namespace
Drupal\Tests\Core\ExtensionCode
public function testFloatVersion() : void {
$float_version = <<<VERSION_TEST
core_version_requirement: '*'
name: 'Float version'
type: module
version: 1.1
VERSION_TEST;
vfsStream::setup('modules');
vfsStream::create([
'fixtures' => [
'float_version.info.txt' => $float_version,
],
]);
$this->expectUserDeprecationMessage("Using a non-string as the 'version' value in vfs://modules/fixtures/float_version.info.txt is deprecated in drupal:11.4.0 and will be a fatal error in drupal:13.0.0. Instead, wrap the version value in single quotes. See https://www.drupal.org/node/3576311");
$info_values = $this->infoParser
->parse(vfsStream::url('modules/fixtures/float_version.info.txt'));
$this->assertSame('1.1', $info_values['version'], 'Floating point version should be cast to a string');
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.