You are here

public function EntityProcessorBaseTest::testGetImportedItemIds in Feeds 8.3

@covers ::getImportedItemIds

File

tests/src/Kernel/Feeds/Processor/EntityProcessorBaseTest.php, line 337

Class

EntityProcessorBaseTest
@coversDefaultClass \Drupal\feeds\Feeds\Processor\EntityProcessorBase @group feeds

Namespace

Drupal\Tests\feeds\Kernel\Feeds\Processor

Code

public function testGetImportedItemIds() {
  $feed_type = $this
    ->createFeedType();
  $feed = $this
    ->createFeed($feed_type
    ->id());

  // Create an entity with a feeds item field.
  $node = $this
    ->createNodeWithFeedsItem($feed);
  $expected = [
    $node
      ->id() => $node
      ->id(),
  ];
  $this
    ->assertEquals($expected, $feed_type
    ->getProcessor()
    ->getImportedItemIds($this->feed));

  // Create two other nodes.
  $node2 = $this
    ->createNodeWithFeedsItem($feed);
  $node3 = $this
    ->createNodeWithFeedsItem($feed);
  $expected = [
    $node
      ->id() => $node
      ->id(),
    $node2
      ->id() => $node2
      ->id(),
    $node3
      ->id() => $node3
      ->id(),
  ];
  $this
    ->assertEquals($expected, $feed_type
    ->getProcessor()
    ->getImportedItemIds($this->feed));
}