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