You are here

public function ParserResultTest::testAddItems in Feeds 8.3

@covers ::addItems

File

tests/src/Unit/Result/ParserResultTest.php, line 43

Class

ParserResultTest
@coversDefaultClass \Drupal\feeds\Result\ParserResult @group feeds

Namespace

Drupal\Tests\feeds\Unit\Result

Code

public function testAddItems() {
  $result = new ParserResult();

  // Create some items.
  $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));
}