You are here

public function FrontMatterTest::testFrontMatterBroken in Drupal 10

Same name in this branch
  1. 10 core/tests/Drupal/Tests/Component/FrontMatter/FrontMatterTest.php \Drupal\Tests\Component\FrontMatter\FrontMatterTest::testFrontMatterBroken()
  2. 10 core/tests/Drupal/KernelTests/Core/Theme/FrontMatterTest.php \Drupal\KernelTests\Core\Theme\FrontMatterTest::testFrontMatterBroken()
Same name and namespace in other branches
  1. 9 core/tests/Drupal/Tests/Component/FrontMatter/FrontMatterTest.php \Drupal\Tests\Component\FrontMatter\FrontMatterTest::testFrontMatterBroken()

Tests broken front matter.

@covers ::__construct @covers ::create @covers ::parse @covers \Drupal\Component\FrontMatter\Exception\FrontMatterParseException

File

core/tests/Drupal/Tests/Component/FrontMatter/FrontMatterTest.php, line 65

Class

FrontMatterTest
Tests front matter parsing helper methods.

Namespace

Drupal\Tests\Component\FrontMatter

Code

public function testFrontMatterBroken() {
  $this
    ->expectException(FrontMatterParseException::class);
  $this
    ->expectExceptionMessage('An error occurred when attempting to parse front matter data on line 4');
  $source = "---\ncollection:\n-  key: foo\n  foo: bar\n---\n";
  FrontMatter::create($source)
    ->getData();
}