You are here

protected function CSVExportViewsDataExportExporterTests::testQuoteOptions in Views data export 7.4

File

tests/exporter_tests/csv.test, line 157

Class

CSVExportViewsDataExportExporterTests

Code

protected function testQuoteOptions() {

  // Write a dataset with quotes inside, and test the quote removal option.
  $dataSet = array(
    array(
      'name' => 'John, the one with cool hair',
      'age' => 25,
      'job' => 'Sin,ger',
      'created' => gmmktime(0, 0, 0, 1, 1, 2000),
    ),
  );
  $result = $this
    ->executeFullWrite($this
    ->getExporter(array(
    'separator' => ",",
    'quote' => true,
  )), $dataSet, 0, array(
    'name' => 'Name',
    'age' => 'Age',
    'job' => 'Job',
    'created' => 'Created',
  ));
  $expected = '"John, the one with cool hair","25","Sin,ger","946684800"
';
  $this
    ->logVerboseResult($result, 'Actual result');
  $this
    ->logVerboseResult($expected, 'Expected result');
  $this
    ->assertEqual($result, $expected, 'The CSV output is as expected.');
}