You are here

private function NodeImportAPITestCase::readFromFile in Node import 6

Read all data from specified file with given file options.

Parameters

$filepath: String. Full path to the file.

$file_offset: Integer. Starting file offset.

$file_options: Array of file options. @see node_import_read_from_file().

Return value

Array of records.

6 calls to NodeImportAPITestCase::readFromFile()
NodeImportAPITestCase::testEmptyLastColumn in tests/node_import.test
Test reading from files with empty last column. See #532182.
NodeImportAPITestCase::testLineEndingsDOS in tests/node_import.test
Test reading from CSV files with DOS line endings (\r\n).
NodeImportAPITestCase::testLineEndingsMac in tests/node_import.test
Test reading from CSV files with MacIntosh line endings (\r).
NodeImportAPITestCase::testLineEndingsUnix in tests/node_import.test
Test reading from CSV files with Unix line endings (\n).
NodeImportAPITestCase::testMultipleLines in tests/node_import.test
Test reading from files with multiple lines in quoted field.

... See full list

File

tests/node_import.test, line 44

Class

NodeImportAPITestCase

Code

private function readFromFile($filepath, $file_offset, $file_options) {
  $data = array();
  $continue = TRUE;
  while ($continue) {
    $ret = node_import_read_from_file($filepath, $file_offset, $file_options);
    if ($ret === FALSE) {
      $continue = FALSE;
    }
    else {
      list($file_offset, $record) = $ret;
      $data[] = $record;
    }
  }
  return $data;
}