function FrontMatterTest::testFrontMatterBroken
Tests broken front matter.
@covers \Drupal\Core\Template\TwigEnvironment::getTemplateMetadata
@covers \Drupal\Component\FrontMatter\Exception\FrontMatterParseException
File
-
core/
tests/ Drupal/ KernelTests/ Core/ Theme/ FrontMatterTest.php, line 74
Class
- FrontMatterTest
- Tests Twig front matter support.
Namespace
Drupal\KernelTests\Core\ThemeCode
public function testFrontMatterBroken() {
$source = "---\ncollection:\n- key: foo\n foo: bar\n---\n" . ComponentFrontMatterTest::SOURCE;
$file = $this->createTwigTemplate($source);
$this->expectException(SyntaxError::class);
$this->expectExceptionMessage('An error occurred when attempting to parse front matter data on line 4 in ' . $file);
$this->twig
->getTemplateMetadata(basename($file));
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.