You are here

protected function ParserCSVTest::_testSimple in Feeds 8.2

Simple test of parsing functionality.

1 call to ParserCSVTest::_testSimple()
ParserCSVTest::test in lib/Drupal/feeds/Tests/ParserCSVTest.php
Test method.

File

lib/Drupal/feeds/Tests/ParserCSVTest.php, line 44
Tests for ParserCSV library.

Class

ParserCSVTest
Test aggregating a feed as node items.

Namespace

Drupal\feeds\Tests

Code

protected function _testSimple() {

  // Pull in the $control_result array.
  include $this
    ->absolutePath() . '/tests/feeds/nodes.csv.php';
  $delimiters = $this
    ->getDelimiters();
  foreach ($delimiters as $delimiterType => $delimiter) {
    $file = $this
      ->absolutePath() . '/tests/feeds/nodes_' . $delimiterType . '.csv';
    $iterator = new ParserCSVIterator($file);
    $parser = new ParserCSV();
    $parser
      ->setDelimiter($delimiter);
    $rows = $parser
      ->parse($iterator);
    $this
      ->assertFalse($parser
      ->lastLinePos(), t('CSV reports all lines parsed, with delimiter: ') . $delimiterType);
    $this
      ->assertEqual(md5(serialize($rows)), md5(serialize($control_result)), t('Parsed result matches control result.'));
  }
}