You are here

protected function CSVExportViewsDataExportExporterTests::testHTMLOptions in Views data export 7.4

Test the HTML escaping option.

File

tests/exporter_tests/csv.test, line 225

Class

CSVExportViewsDataExportExporterTests

Code

protected function testHTMLOptions() {

  // Write a dataset with HTML inside, and test that it's kept.
  $dataSet = array(
    array(
      'name' => '<em>John</em>',
      'age' => 25,
      'job' => 'Singer',
      'created' => gmmktime(0, 0, 0, 1, 1, 2000),
    ),
  );
  $result = $this
    ->executeFullWrite($this
    ->getExporter(array(
    'separator' => ",",
    'quote' => true,
    'keep_html' => true,
  )), $dataSet, 0, array(
    'name' => 'Name',
    'age' => 'Age',
    'job' => 'Job',
    'created' => 'Created',
  ));
  $expected = '"<em>John</em>","25","Singer","946684800"
';
  $this
    ->logVerboseResult($result, 'Actual result');
  $this
    ->logVerboseResult($expected, 'Expected result');
  $this
    ->assertEqual($result, $expected, 'The CSV output is as expected.');
}