class XMLExporterTest in Loft Data Grids 7.2
Hierarchy
- class \AKlump\LoftDataGrids\ExporterBase extends \AKlump\LoftDataGrids\PHPUnit_Framework_TestCase
- class \AKlump\LoftDataGrids\XMLExporterTest
Expanded class hierarchy of XMLExporterTest
File
- vendor/
aklump/ loft_data_grids/ tests/ phpunit/ XMLExporterTest.php, line 11 - Tests for the XMLExporter class
Namespace
AKlump\LoftDataGridsView source
class XMLExporterTest extends ExporterBase {
public function testDateTimeObjectHandling() {
$this
->assertDateHandlerWorks(function ($date) {
return '<?xml version="1.0"?>
<data><page id="0"><record id="0"><date>' . $date . '</date></record></page></data>
';
});
}
public function testCData() {
$data = new ExportData();
$data
->add('title', '<h1>Some</h1>');
$this->exporter
->setData($data);
$control = '<?xml version="1.0"?>
<data><page id="0"><record id="0"><title><![CDATA[<h1>Some</h1>]]></title></record></page></data>
';
$this
->assertSame($control, $this->exporter
->export());
}
public function testOutput0() {
$control = '<?xml version="1.0"?>
<data><page id="0"><record id="0"><order_no_>1181</order_no_><customer_billing_country>US</customer_billing_country><california_taxed_purchase_amount>0</california_taxed_purchase_amount></record></page></data>
';
$subject = $this->exporter
->export(0);
$this
->assertSame($control, $subject);
}
public function testOutput1() {
$control = '<?xml version="1.0"?>
<data><page id="1"><record id="0"><order_no_>1182</order_no_><transaction_date>11/7/13</transaction_date><customer_name>Hope, Roberta</customer_name></record></page></data>
';
$subject = $this->exporter
->export(1);
$this
->assertSame($control, $subject);
}
public function testOutput() {
$control = '<?xml version="1.0"?>
<data><page id="0"><record id="0"><order_no_>1181</order_no_><customer_billing_country>US</customer_billing_country><california_taxed_purchase_amount>0</california_taxed_purchase_amount></record></page><page id="1"><record id="0"><order_no_>1182</order_no_><transaction_date>11/7/13</transaction_date><customer_name>Hope, Roberta</customer_name></record></page></data>
';
$subject = $this->exporter
->export();
$this
->assertSame($control, $subject);
$this
->assertMethodSaveFile();
$this
->assertSandboxFileContents($control);
}
public function testInfoValues() {
$info = $this->exporter
->getInfo();
$this
->assertSame('.xml', $info['extension']);
}
public function setUp() {
parent::setUp();
$this->exporter = new XMLExporter($this->data);
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
ExporterBase:: |
public | function | ||
ExporterBase:: |
public | function | Make sure that saveFile creates a file and returns the path. | |
ExporterBase:: |
public | function | ||
ExporterBase:: |
public | function | Compare the sandbox file against it's control file. | |
ExporterBase:: |
public | function | ||
ExporterBase:: |
public | function | ||
ExporterBase:: |
public | function | ||
ExporterBase:: |
public | function | @expectedException RuntimeException | |
XMLExporterTest:: |
public | function |
Overrides ExporterBase:: |
|
XMLExporterTest:: |
public | function | ||
XMLExporterTest:: |
public | function | ||
XMLExporterTest:: |
public | function | ||
XMLExporterTest:: |
public | function | ||
XMLExporterTest:: |
public | function | ||
XMLExporterTest:: |
public | function |