You are here

public function HelpTopicTwigLoaderTest::testGetSourceContextException in Drupal 8

Same name and namespace in other branches
  1. 9 core/modules/help_topics/tests/src/Unit/HelpTopicTwigLoaderTest.php \Drupal\Tests\help_topics\Unit\HelpTopicTwigLoaderTest::testGetSourceContextException()

@covers ::getSourceContext

File

core/modules/help_topics/tests/src/Unit/HelpTopicTwigLoaderTest.php, line 66

Class

HelpTopicTwigLoaderTest
Unit test for the HelpTopicTwigLoader class.

Namespace

Drupal\Tests\help_topics\Unit

Code

public function testGetSourceContextException() {
  $this
    ->expectException(LoaderError::class);
  $this
    ->expectExceptionMessage("Malformed YAML in help topic \"vfs://root/modules/test/help_topics/test.invalid_yaml.html.twig\":");
  $source = $this->helpLoader
    ->getSourceContext('@' . HelpTopicTwigLoader::MAIN_NAMESPACE . '/test.invalid_yaml.html.twig');
}