You are here

public function UploadFetcherTest::testImportSingleFile in Feeds 8.3

Tests importing a feed using the upload fetcher.

File

tests/src/Functional/Feeds/Fetcher/UploadFetcherTest.php, line 39

Class

UploadFetcherTest
@coversDefaultClass \Drupal\feeds\Feeds\Fetcher\UploadFetcher @group feeds

Namespace

Drupal\Tests\feeds\Functional\Feeds\Fetcher

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() . '/rss/googlenewstz.rss2'),
  ];
  $this
    ->drupalPostForm('feed/add/' . $this->feedType
    ->id(), $edit, t('Save and import'));

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

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