class YAMLFrontMatterImporterTest in Loft Data Grids 7.2
Hierarchy
- class \AKlump\LoftDataGrids\YAMLFrontMatterImporterTest extends \AKlump\LoftDataGrids\PHPUnit_Framework_TestCase
Expanded class hierarchy of YAMLFrontMatterImporterTest
File
- vendor/
aklump/ loft_data_grids/ tests/ phpunit/ YAMLFrontMatterImporterTest.php, line 6
Namespace
AKlump\LoftDataGridsView source
class YAMLFrontMatterImporterTest extends \PHPUnit_Framework_TestCase {
public function testAddSettingReturnsThis() {
$obj = new YAMLFrontMatterImporter();
$this
->assertSame($obj, $obj
->addSetting('bodyKey', 'footer'));
}
public function testImportWithoutFrontMatter() {
$subject = '<h1> {{ title }} </h1>
<p> {{ description }} </p>
Page content here...';
$obj = new YAMLFrontMatterImporter();
$data = $obj
->import($subject);
$this
->assertInstanceOf('AKlump\\LoftDataGrids\\ExportData', $data);
$this
->assertSame($subject, $data
->getValue('body'));
}
public function testImportEmptyString() {
$obj = new YAMLFrontMatterImporter();
$data = $obj
->import('');
$this
->assertInstanceOf('AKlump\\LoftDataGrids\\ExportData', $data);
$this
->assertSame('', $data
->getValue('body'));
}
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'));
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
YAMLFrontMatterImporterTest:: |
public | function | ||
YAMLFrontMatterImporterTest:: |
public | function | ||
YAMLFrontMatterImporterTest:: |
public | function | ||
YAMLFrontMatterImporterTest:: |
public | function |