You are here

public function FeedsEventsTest::testSkipImportOnPresave in Feeds 8.3

Tests skip import on presave feature.

File

tests/src/Kernel/FeedsEventsTest.php, line 116

Class

FeedsEventsTest
Tests for dispatching feeds events.

Namespace

Drupal\Tests\feeds\Kernel

Code

public function testSkipImportOnPresave() {
  $feed_type = $this
    ->createFeedTypeForCsv([
    'guid' => 'guid',
    'title' => 'title',
  ], [
    'id' => 'import_skip',
  ]);

  // Import feed.
  $feed = $this
    ->createFeed($feed_type
    ->id(), [
    'source' => $this
      ->resourcesPath() . '/csv/content.csv',
  ]);
  $feed
    ->import();

  // Assert that only the second item was imported.
  $this
    ->assertNodeCount(1);
  $node = Node::load(1);
  $this
    ->assertEquals('Ut wisi enim ad minim veniam', $node
    ->getTitle());
}