function FrontMatterTest::testFrontMatterBroken
Same name in this branch
- 9 core/tests/Drupal/Tests/Component/FrontMatter/FrontMatterTest.php \Drupal\Tests\Component\FrontMatter\FrontMatterTest::testFrontMatterBroken()
Same name in other branches
- 10 core/tests/Drupal/KernelTests/Core/Theme/FrontMatterTest.php \Drupal\KernelTests\Core\Theme\FrontMatterTest::testFrontMatterBroken()
- 10 core/tests/Drupal/Tests/Component/FrontMatter/FrontMatterTest.php \Drupal\Tests\Component\FrontMatter\FrontMatterTest::testFrontMatterBroken()
- 11.x core/tests/Drupal/KernelTests/Core/Theme/FrontMatterTest.php \Drupal\KernelTests\Core\Theme\FrontMatterTest::testFrontMatterBroken()
- 11.x core/tests/Drupal/Tests/Component/FrontMatter/FrontMatterTest.php \Drupal\Tests\Component\FrontMatter\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.