You are here

public function CsvParserFeedFormTest::testImportSingleFile in Feeds 8.3

Tests importing a feed using the default settings.

File

tests/src/Functional/Feeds/Parser/Form/CsvParserFeedFormTest.php, line 49

Class

CsvParserFeedFormTest
@coversDefaultClass \Drupal\feeds\Feeds\Parser\Form\CsvParserFeedForm @group feeds

Namespace

Drupal\Tests\feeds\Functional\Feeds\Parser\Form

Code

public function testImportSingleFile() {

  // Create feed and import.
  $edit = [
    'title[0][value]' => $this
      ->randomMachineName(),
    'files[plugin_fetcher_source]' => \Drupal::service('file_system')
      ->realpath($this
      ->resourcesPath() . '/csv/nodes_comma.csv'),
  ];
  $this
    ->drupalPostForm('feed/add/' . $this->feedType
    ->id(), $edit, t('Save and import'));

  // Load feed.
  $feed = Feed::load(1);

  // Assert that 2 nodes have been created.
  static::assertEquals(9, $feed
    ->getItemCount());
  $this
    ->assertNodeCount(9);
}