protected function ParserCSVTest::_testSimple in Feeds 7.2
Same name and namespace in other branches
- 6 tests/parser_csv.test \ParserCSVTest::_testSimple()
- 7 tests/parser_csv.test \ParserCSVTest::_testSimple()
Simple test of parsing functionality.
1 call to ParserCSVTest::_testSimple()
- ParserCSVTest::test in tests/
parser_csv.test - Test method.
File
- tests/
parser_csv.test, line 45 - Tests for ParserCSV library.
Class
- ParserCSVTest
- Test aggregating a feed as node items.
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.'));
}
}