You are here

public function FeedTest::testStartBatchImport in Feeds 8.3

@covers ::startBatchImport

File

tests/src/Kernel/Entity/FeedTest.php, line 125

Class

FeedTest
@coversDefaultClass \Drupal\feeds\Entity\Feed @group feeds

Namespace

Drupal\Tests\feeds\Kernel\Entity

Code

public function testStartBatchImport() {
  $feed = $this
    ->createFeed($this->feedType
    ->id(), [
    'source' => $this
      ->resourcesPath() . '/rss/googlenewstz.rss2',
  ]);

  // Assert that no batch was started yet.
  $this
    ->assertEquals([], batch_get());

  // Start batch import.
  $feed
    ->startBatchImport();

  // Assert that a single batch was initiated now.
  $batch = batch_get();
  $this
    ->assertCount(1, $batch['sets']);
}