public function InfoParserUnitTest::testInvalidLifecycle in Drupal 10
Same name and namespace in other branches
- 9 core/tests/Drupal/Tests/Core/Extension/InfoParserUnitTest.php \Drupal\Tests\Core\Extension\InfoParserUnitTest::testInvalidLifecycle()
Tests an info file with invalid lifecycle values.
@covers ::parse
@dataProvider providerInvalidLifecycle
File
- core/
tests/ Drupal/ Tests/ Core/ Extension/ InfoParserUnitTest.php, line 441
Class
- InfoParserUnitTest
- Tests InfoParser class and exception.
Namespace
Drupal\Tests\Core\ExtensionCode
public function testInvalidLifecycle($lifecycle, $exception_message) {
$info = <<<INFO
package: Core
core_version_requirement: '*'
version: VERSION
type: module
name: Module for That
INFO;
$info .= "\nlifecycle: {$lifecycle}\n";
vfsStream::setup('modules');
$filename = "lifecycle-{$lifecycle}.info.txt";
vfsStream::create([
'fixtures' => [
$filename => $info,
],
]);
$this
->expectException('\\Drupal\\Core\\Extension\\InfoParserException');
$this
->expectExceptionMessage($exception_message);
$info_values = $this->infoParser
->parse(vfsStream::url("modules/fixtures/{$filename}"));
$this
->assertEmpty($info_values);
}