public function InfoParserUnitTest::testInfoParserMissingKeys in Drupal 9
Same name and namespace in other branches
- 8 core/tests/Drupal/Tests/Core/Extension/InfoParserUnitTest.php \Drupal\Tests\Core\Extension\InfoParserUnitTest::testInfoParserMissingKeys()
- 10 core/tests/Drupal/Tests/Core/Extension/InfoParserUnitTest.php \Drupal\Tests\Core\Extension\InfoParserUnitTest::testInfoParserMissingKeys()
Tests that missing required keys are detected.
@covers ::parse
File
- core/
tests/ Drupal/ Tests/ Core/ Extension/ InfoParserUnitTest.php, line 86
Class
- InfoParserUnitTest
- Tests InfoParser class and exception.
Namespace
Drupal\Tests\Core\ExtensionCode
public function testInfoParserMissingKeys() {
$missing_keys = <<<MISSINGKEYS
# info.yml for testing missing name, description, and type keys.
package: Core
version: VERSION
dependencies:
- field
MISSINGKEYS;
vfsStream::setup('modules');
vfsStream::create([
'fixtures' => [
'missing_keys.info.txt' => $missing_keys,
],
]);
$filename = vfsStream::url('modules/fixtures/missing_keys.info.txt');
$this
->expectException('\\Drupal\\Core\\Extension\\InfoParserException');
$this
->expectExceptionMessage('Missing required keys (type, name) in vfs://modules/fixtures/missing_keys.info.txt');
$this->infoParser
->parse($filename);
}