You are here

public function YAMLFrontMatterImporterTest::testExample in Loft Data Grids 7.2

File

vendor/aklump/loft_data_grids/tests/phpunit/YAMLFrontMatterImporterTest.php, line 34

Class

YAMLFrontMatterImporterTest

Namespace

AKlump\LoftDataGrids

Code

public function testExample() {
  $subject = '---
title: \'YAML Front Matter\'
description: \'A very simple way to add structured data to a page.\'
---
<h1> {{ title }} </h1>
<p> {{ description }} </p>
Page content here...';
  $obj = new YAMLFrontMatterImporter();
  $data = $obj
    ->import($subject);
  $this
    ->assertInstanceOf('AKlump\\LoftDataGrids\\ExportData', $data);
  $this
    ->assertSame('YAML Front Matter', $data
    ->getValue('title'));
  $this
    ->assertSame('A very simple way to add structured data to a page.', $data
    ->getValue('description'));
  $this
    ->assertSame('<h1> {{ title }} </h1>
<p> {{ description }} </p>
Page content here...', $data
    ->getValue('body'));
}