public function JsonPathLinesParserTest::testBatching in Feeds extensible parsers 8
Tests batch parsing.
File
- tests/
src/ Unit/ Feeds/ Parser/ JsonPathLinesParserTest.php, line 64
Class
- JsonPathLinesParserTest
- @coversDefaultClass \Drupal\feeds_ex\Feeds\Parser\JsonPathLinesParser @group feeds_ex
Namespace
Drupal\Tests\feeds_ex\Unit\Feeds\ParserCode
public function testBatching() {
$config = [
'sources' => [
'title' => [
'name' => 'Title',
'value' => 'name',
],
],
'line_limit' => 1,
];
$this->parser
->setConfiguration($config);
foreach ([
'Gilbert',
'Alexa',
'May',
'Deloise',
] as $name) {
$result = $this->parser
->parse($this->feed, $this->fetcherResult, $this->state);
$this
->assertCount(1, $result);
$this
->assertSame($result[0]
->get('title'), $name);
}
// We should be out of items.
$result = $this->parser
->parse($this->feed, $this->fetcherResult, $this->state);
$this
->assertCount(0, $result);
}