You are here

class YAMLFrontMatterExporterTest in Loft Data Grids 7.2

Hierarchy

Expanded class hierarchy of YAMLFrontMatterExporterTest

File

vendor/aklump/loft_data_grids/tests/phpunit/YAMLFrontMatterExporterTest.php, line 11
Tests for the YAMLFrontMatterExporter class

Namespace

AKlump\LoftDataGrids
View source
class YAMLFrontMatterExporterTest extends ExporterBase {
  public function testExportNoFrontMatter() {
    $html = new ExportData();
    $html
      ->add('body', '<h1> {{ title }} </h1>
<p> {{ description }} </p>
Page content here...');
    $exporter = new YAMLFrontMatterExporter($html);
    $control = '<h1> {{ title }} </h1>
<p> {{ description }} </p>
Page content here...';
    $this
      ->assertSame($control, $exporter
      ->export());
  }
  public function testExportNoBody() {
    $html = new ExportData();
    $html
      ->add('title', 'YAML Front Matter')
      ->add('description', 'A very simple way to add structured data to a page.');
    $exporter = new YAMLFrontMatterExporter($html);
    $control = '---
title: \'YAML Front Matter\'
description: \'A very simple way to add structured data to a page.\'
---
';
    $this
      ->assertSame($control, $exporter
      ->export());
  }
  public function testExport() {
    $html = new ExportData();
    $html
      ->add('title', 'YAML Front Matter')
      ->add('description', 'A very simple way to add structured data to a page.')
      ->add('body', '<h1> {{ title }} </h1>
<p> {{ description }} </p>
Page content here...');
    $exporter = new YAMLFrontMatterExporter($html);
    $control = '---
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...';
    $this
      ->assertSame($control, $exporter
      ->export());
  }
  public function testGetInfo() {
    $info = $this->exporter
      ->getInfo();
    $this
      ->assertSame('.html', $info['extension']);
    $this
      ->assertSame('AKlump\\LoftDataGrids\\YAMLFrontMatterExporter', $info['class']);
  }
  public function setUp() {
    parent::setUp();
    $this->exporter = new YAMLFrontMatterExporter($this->data);
  }

}

Members

Namesort descending Modifiers Type Description Overrides
ExporterBase::assertDateHandlerWorks public function
ExporterBase::assertMethodSaveFile public function Make sure that saveFile creates a file and returns the path.
ExporterBase::assertSandboxFileContents public function
ExporterBase::assertSandboxFileEquals public function Compare the sandbox file against it's control file.
ExporterBase::tearDown public function
ExporterBase::testCompileReturnsSelf public function
ExporterBase::testInfo public function
ExporterBase::testSaveFileToUnwriteableDirThrows public function @expectedException RuntimeException
YAMLFrontMatterExporterTest::setUp public function Overrides ExporterBase::setUp
YAMLFrontMatterExporterTest::testExport public function
YAMLFrontMatterExporterTest::testExportNoBody public function
YAMLFrontMatterExporterTest::testExportNoFrontMatter public function
YAMLFrontMatterExporterTest::testGetInfo public function