You are here

public function CsvParserTest::testHasHeader in Feeds 8.3

@covers ::setHasHeader @covers ::getHeader

File

tests/src/Unit/Component/CsvParserTest.php, line 84

Class

CsvParserTest
@coversDefaultClass \Drupal\feeds\Component\CsvParser @group feeds

Namespace

Drupal\Tests\feeds\Unit\Component

Code

public function testHasHeader() {
  $file = dirname(dirname(dirname(dirname(__DIR__)))) . '/tests/resources/csv/example.csv';
  $parser = CsvParser::createFromFilePath($file)
    ->setHasHeader();
  $this
    ->assertSame(count(iterator_to_array($parser)), 6);
  $this
    ->assertSame([
    'Header A',
    'Header B',
    'Header C',
  ], $parser
    ->getHeader());
}