public function NodeImportAPITestCase::testMultipleLines in Node import 6
Test reading from files with multiple lines in quoted field.
File
- tests/
node_import.test, line 187
Class
Code
public function testMultipleLines() {
$filepath = drupal_get_path('module', 'node_import') . '/tests/multiple-lines.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
with multiple
lines',
),
array(
'third title',
'third body
with multiple
lines
including
empty line',
),
);
$data = $this
->readFromFile($filepath, $file_offset, $file_options);
$this
->assertTrue($this
->compareData($data, $file_data), t('Correctly read data from file.'));
}