public function HelpTopicDiscoveryTest::testHelpTopicsBrokenYaml in Drupal 8
Same name and namespace in other branches
- 9 core/modules/help_topics/tests/src/Unit/HelpTopicDiscoveryTest.php \Drupal\Tests\help_topics\Unit\HelpTopicDiscoveryTest::testHelpTopicsBrokenYaml()
@covers ::findAll
File
- core/
modules/ help_topics/ tests/ src/ Unit/ HelpTopicDiscoveryTest.php, line 199
Class
- HelpTopicDiscoveryTest
- @coversDefaultClass \Drupal\help_topics\HelpTopicDiscovery @group help_topics
Namespace
Drupal\Tests\help_topics\UnitCode
public function testHelpTopicsBrokenYaml() {
vfsStream::setup('root');
$topic_content = <<<EOF
---
foo : [bar}
---
<h2>Test</h2>
EOF;
vfsStream::create([
'modules' => [
'help_topics' => [
'help_topics' => [
'core.topic.html.twig' => $topic_content,
],
],
],
]);
$discovery = new HelpTopicDiscovery([
'help_topics' => vfsStream::url('root/modules/help_topics/help_topics'),
]);
$this
->expectException(DiscoveryException::class);
$this
->expectExceptionMessage("Malformed YAML in help topic \"vfs://root/modules/help_topics/help_topics/core.topic.html.twig\":");
$discovery
->getDefinitions();
}