ParserResultTest.php in Feeds 8.3
File
tests/src/Unit/Result/ParserResultTest.php
View source
<?php
namespace Drupal\Tests\feeds\Unit\Result;
use Drupal\feeds\Feeds\Item\ItemInterface;
use Drupal\feeds\Result\ParserResult;
use Drupal\Tests\feeds\Unit\FeedsUnitTestCase;
class ParserResultTest extends FeedsUnitTestCase {
public function testAddItem() {
$result = new ParserResult();
$item1 = $this
->createMock(ItemInterface::class);
$item2 = $this
->createMock(ItemInterface::class);
$item3 = $this
->createMock(ItemInterface::class);
$result
->addItem($item1);
$this
->assertSame(1, $result
->count());
$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));
}
public function testAddItems() {
$result = new ParserResult();
$item1 = $this
->createMock(ItemInterface::class);
$item2 = $this
->createMock(ItemInterface::class);
$item3 = $this
->createMock(ItemInterface::class);
$result
->addItems([
$item1,
$item2,
$item3,
]);
$this
->assertSame(3, $result
->count());
$this
->assertSame($item1, $result
->offsetGet(0));
$this
->assertSame($item2, $result
->offsetGet(1));
$this
->assertSame($item3, $result
->offsetGet(2));
}
}