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