public function InfoParserUnitTest::testInvalidLifecycle in Drupal 9
Tests an info file with invalid lifecycle values.
@covers ::parse
@dataProvider providerInvalidLifecycle
File
- core/
tests/ Drupal/ Tests/ Core/ Extension/ InfoParserUnitTest.php, line 762
Class
- InfoParserUnitTest
- Tests InfoParser class and exception.
Namespace
Drupal\Tests\Core\ExtensionCode
public function testInvalidLifecycle($lifecycle, $exception_message) {
$info = <<<INFO
package: Core
core: 8.x
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);
}