You are here

protected function CSVExportViewsDataExportExporterTests::testTrim in Views data export 7.4

Test the whitespace trim function

File

tests/exporter_tests/csv.test, line 132

Class

CSVExportViewsDataExportExporterTests

Code

protected function testTrim() {
  $dataSet = array(
    array(
      'name' => '      John      ',
      'age' => 25,
      'job' => 'Singer',
      'created' => gmmktime(0, 0, 0, 1, 1, 2000),
    ),
  );
  $result = $this
    ->executeFullWrite($this
    ->getExporter(array(
    'trim' => true,
  )), $dataSet, 0, array(
    'name' => 'Name',
    'age' => 'Age',
    'job' => 'Job',
    'created' => 'Created',
  ));
  $expected = '"John","25","Singer","946684800"
';
  $this
    ->logVerboseResult($result, 'Actual result');
  $this
    ->logVerboseResult($expected, 'Expected result');
  $this
    ->assertEqual($result, $expected, 'The CSV output is as expected.');
}