public function InfoParserUnitTest::testInfoParserBroken in Drupal 8
Same name and namespace in other branches
- 9 core/tests/Drupal/Tests/Core/Extension/InfoParserUnitTest.php \Drupal\Tests\Core\Extension\InfoParserUnitTest::testInfoParserBroken()
- 10 core/tests/Drupal/Tests/Core/Extension/InfoParserUnitTest.php \Drupal\Tests\Core\Extension\InfoParserUnitTest::testInfoParserBroken()
Test if correct exception is thrown for a broken info file.
@covers ::parse
File
- core/
tests/ Drupal/ Tests/ Core/ Extension/ InfoParserUnitTest.php, line 55
Class
- InfoParserUnitTest
- Tests InfoParser class and exception.
Namespace
Drupal\Tests\Core\ExtensionCode
public function testInfoParserBroken() {
$broken_info = <<<BROKEN_INFO
# info.yml for testing broken YAML parsing exception handling.
name: File
type: module
description: 'Defines a file field type.'
package: Core
version: VERSION
core: 8.x
dependencies::;;
- field
BROKEN_INFO;
vfsStream::setup('modules');
vfsStream::create([
'fixtures' => [
'broken.info.txt' => $broken_info,
],
]);
$filename = vfsStream::url('modules/fixtures/broken.info.txt');
$this
->expectException('\\Drupal\\Core\\Extension\\InfoParserException');
$this
->expectExceptionMessage('broken.info.txt');
$this->infoParser
->parse($filename);
}