public function ParserResultTest::testAddItem in Feeds 8.3
@covers ::addItem
File
- tests/
src/ Unit/ Result/ ParserResultTest.php, line 18
Class
- ParserResultTest
- @coversDefaultClass \Drupal\feeds\Result\ParserResult @group feeds
Namespace
Drupal\Tests\feeds\Unit\ResultCode
public function testAddItem() {
$result = new ParserResult();
// Create some items.
$item1 = $this
->createMock(ItemInterface::class);
$item2 = $this
->createMock(ItemInterface::class);
$item3 = $this
->createMock(ItemInterface::class);
// Add an item.
$result
->addItem($item1);
$this
->assertSame(1, $result
->count());
// Add another two items.
$result
->addItem($item2);
$result
->addItem($item3);
$this
->assertSame(3, $result
->count());
$this
->assertSame($item1, $result
->offsetGet(0));
$this
->assertSame($item2, $result
->offsetGet(1));
$this
->assertSame($item3, $result
->offsetGet(2));
}