function InfoParserUnitTest::testValidLifecycle
Same name in other branches
- 10 core/tests/Drupal/Tests/Core/Extension/InfoParserUnitTest.php \Drupal\Tests\Core\Extension\InfoParserUnitTest::testValidLifecycle()
- 11.x core/tests/Drupal/Tests/Core/Extension/InfoParserUnitTest.php \Drupal\Tests\Core\Extension\InfoParserUnitTest::testValidLifecycle()
Tests an info file with valid lifecycle values.
@covers ::parse
@dataProvider providerValidLifecycle
File
-
core/
tests/ Drupal/ Tests/ Core/ Extension/ InfoParserUnitTest.php, line 702
Class
- InfoParserUnitTest
- Tests InfoParser class and exception.
Namespace
Drupal\Tests\Core\ExtensionCode
public function testValidLifecycle($lifecycle, $expected) {
$info = <<<INFO
package: Core
core: 8.x
version: VERSION
type: module
name: Module for That
INFO;
if (!empty($lifecycle)) {
$info .= "\nlifecycle: {$lifecycle}\n";
}
if (in_array($lifecycle, [
ExtensionLifecycle::DEPRECATED,
ExtensionLifecycle::OBSOLETE,
], TRUE)) {
$info .= "\nlifecycle_link: http://example.com\n";
}
vfsStream::setup('modules');
$filename = "lifecycle-{$lifecycle}.info.yml";
vfsStream::create([
'fixtures' => [
$filename => $info,
],
]);
$info_values = $this->infoParser
->parse(vfsStream::url("modules/fixtures/{$filename}"));
$this->assertSame($expected, $info_values[ExtensionLifecycle::LIFECYCLE_IDENTIFIER]);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.