You are here

public function LineIteratorTest::testFileResume in Feeds extensible parsers 8

Tests resuming file position.

File

tests/src/Unit/File/LineIteratorTest.php, line 39

Class

LineIteratorTest
@coversDefaultClass \Drupal\feeds_ex\File\LineIterator @group feeds_ex

Namespace

Drupal\Tests\feeds_ex\Unit\File

Code

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