function 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\FrontMatterCode
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();
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.