You are here

public function NodeImportAPITestCase::testEmptyLastColumn in Node import 6

Test reading from files with empty last column. See #532182.

File

tests/node_import.test, line 217

Class

NodeImportAPITestCase

Code

public function testEmptyLastColumn() {
  $filepath = drupal_get_path('module', 'node_import') . '/tests/empty-last-column.csv';
  $file_offset = 0;
  $file_options = array(
    'record separator' => '<newline>',
    'field separator' => ',',
    'text delimiter' => '"',
    'escape character' => '\\',
  );
  $file_data = array(
    array(
      'title',
      'body',
    ),
    array(
      'a',
      '',
    ),
    array(
      'b',
      '',
    ),
    array(
      'c',
      '',
    ),
  );
  $data = $this
    ->readFromFile($filepath, $file_offset, $file_options);
  $this
    ->assertTrue($this
    ->compareData($data, $file_data), t('Correctly read data from file.'));
}