createFrontMatterSource example


  public function testFrontMatterData($yaml$line$content = self::SOURCE) {
    $source = static::createFrontMatterSource($yaml$content);
    $frontMatter = FrontMatter::create($source);
    $this->assertEquals($content$frontMatter->getContent());
    $this->assertEquals($yaml === NULL ? [] : $yaml$frontMatter->getData());
    $this->assertEquals($line$frontMatter->getLine());
  }

  /** * Provides the front matter data to test. * * @return array * Array of front matter data. */

  public function testFrontMatter($yaml$line$content = ComponentFrontMatterTest::SOURCE) {
    // Create a temporary Twig template.     $source = ComponentFrontMatterTest::createFrontMatterSource($yaml$content);
    $file = $this->createTwigTemplate($source);
    $name = basename($file);

    // Ensure the proper metadata is returned.     $metadata = $this->twig->getTemplateMetadata($name);
    $this->assertEquals($yaml === NULL ? [] : $yaml$metadata);

    // Ensure the metadata is never rendered.     $output = $this->twig->load($name)->render();
    $this->assertEquals($content$output);

    
Home | Imprint | This part of the site doesn't use cookies.