You are here

public function NodeImportAPITestCase::testLineEndingsDOS in Node import 6

Test reading from CSV files with DOS line endings (\r\n).

File

tests/node_import.test, line 120

Class

NodeImportAPITestCase

Code

public function testLineEndingsDOS() {
  $filepath = drupal_get_path('module', 'node_import') . '/tests/line-endings-dos.csv';
  $file_offset = 0;
  $file_options = array(
    'record separator' => '<newline>',
    'field separator' => ',',
    'text delimiter' => '"',
    'escape character' => '\\',
  );
  $file_data = array(
    array(
      'title',
      'body',
    ),
    array(
      'first title',
      'first body',
    ),
    array(
      'second title',
      'second body',
    ),
    array(
      'third title',
      'third body',
    ),
  );
  $data = $this
    ->readFromFile($filepath, $file_offset, $file_options);
  $this
    ->assertTrue($this
    ->compareData($data, $file_data), t('Correctly read data from file.'));
}