function FrontMatterTest::testFrontMatterData
Same name and namespace in other branches
- 10 core/tests/Drupal/Tests/Component/FrontMatter/FrontMatterTest.php \Drupal\Tests\Component\FrontMatter\FrontMatterTest::testFrontMatterData()
- 9 core/tests/Drupal/Tests/Component/FrontMatter/FrontMatterTest.php \Drupal\Tests\Component\FrontMatter\FrontMatterTest::testFrontMatterData()
Tests the parsed data from front matter.
@legacy-covers ::__construct @legacy-covers ::getContent @legacy-covers ::getData @legacy-covers ::getLine @legacy-covers ::create @legacy-covers ::parse
Attributes
#[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 92
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.