You are here

public function LineIteratorTest::testLineLimit in Feeds extensible parsers 8

Tests settings line limits.

File

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

Class

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

Namespace

Drupal\Tests\feeds_ex\Unit\File

Code

public function testLineLimit() {
  foreach (range(1, 4) as $limit) {
    $iterator = new LineIterator($this->moduleDir . '/tests/resources/test.jsonl');
    $iterator
      ->setLineLimit($limit);
    $array = iterator_to_array($iterator);
    $this
      ->assertCount($limit, $array, new FormattableMarkup('@count lines read.', [
      '@count' => count($array),
    ]));
  }
}