You are here

public function FeedsExLineIteratorUnitTests::testFileResume in Feeds extensible parsers 7.2

Tests resuming file position.

File

src/Tests/FeedsExUnitTests.test, line 222
Contains unit tests for feeds_ex.

Class

FeedsExLineIteratorUnitTests
Reading a line from a file.

Code

public function testFileResume() {
  $iterator = new FeedsExLineIterator($this->moduleDir . '/tests/resources/test.jsonl');
  $iterator
    ->setLineLimit(1);
  foreach (array(
    'Gilbert',
    'Alexa',
    'May',
    'Deloise',
  ) as $name) {
    foreach ($iterator as $line) {
      $line = drupal_json_decode($line);
      $this
        ->assertEqual($line['name'], $name);
    }
    $iterator
      ->setStartPosition($iterator
      ->ftell());
  }
}