function FrontMatterTest::testFrontMatterData
Same name in other branches
- 9 core/tests/Drupal/Tests/Component/FrontMatter/FrontMatterTest.php \Drupal\Tests\Component\FrontMatter\FrontMatterTest::testFrontMatterData()
- 11.x core/tests/Drupal/Tests/Component/FrontMatter/FrontMatterTest.php \Drupal\Tests\Component\FrontMatter\FrontMatterTest::testFrontMatterData()
Tests the parsed data from front matter.
@covers ::__construct @covers ::getContent @covers ::getData @covers ::getLine @covers ::create @covers ::parse
@dataProvider providerFrontMatterData
Parameters
array|null $yaml: The YAML used as front matter data to prepend the source.
int $line: The expected line number where the source code starts.
string $content: The content to use for testing purposes.
File
-
core/
tests/ Drupal/ Tests/ Component/ FrontMatter/ FrontMatterTest.php, line 93
Class
- FrontMatterTest
- Tests front matter parsing helper methods.
Namespace
Drupal\Tests\Component\FrontMatterCode
public function testFrontMatterData($yaml, $line, $content = self::SOURCE) : void {
$source = static::createFrontMatterSource($yaml, $content);
$frontMatter = FrontMatter::create($source);
$this->assertEquals($content, $frontMatter->getContent());
$this->assertEquals($yaml ?? [], $frontMatter->getData());
$this->assertEquals($line, $frontMatter->getLine());
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.