protected function XMLExportViewsDataExportExporterTests::testBodyWrite in Views data export 7.4
Test that rows are written correctly.
File
- tests/
exporter_tests/ xml.test, line 49
Class
Code
protected function testBodyWrite() {
$dataSet = array(
array(
'name' => 'John Lennon',
'their age' => 25,
'pets' => array(
'cat' => 'figaro',
'dog' => 'pluto',
),
'colours' => array(
'red',
'blue',
),
'their job' => 'they are a Singer',
'created' => gmmktime(0, 0, 0, 1, 1, 2000),
),
);
$result = $this
->executeFullWrite($this
->getExporter(), $dataSet, 0, array(
'name' => 'name',
'their age' => 'their age',
'pets' => 'pets',
'cat' => 'cat',
'dog' => 'dog',
'colours' => 'colours',
'their job' => 'their job',
'created' => 'created',
));
$expected = ' <item>
<name>John Lennon</name>
<their-age>25</their-age>
<pets>
<cat>figaro</cat>
<dog>pluto</dog>
</pets>
<colours>
<data>red</data>
<data>blue</data>
</colours>
<their-job>they are a Singer</their-job>
<created>946684800</created>
</item>
';
$this
->logVerboseResult($result, 'Actual result');
$this
->logVerboseResult($expected, 'Expected result');
$this
->assertEqual($result, $expected, 'The content is as expected.');
}