You are here

public function NodeImportAPITestCase::testLineEndingsUnix in Node import 6

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

File

tests/node_import.test, line 97

Class

NodeImportAPITestCase

Code

public function testLineEndingsUnix() {
  $filepath = drupal_get_path('module', 'node_import') . '/tests/line-endings-unix.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.'));
}