You are here

public function FeedTest::testStartBatchClear in Feeds 8.3

@covers ::startBatchClear

File

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

Class

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

Namespace

Drupal\Tests\feeds\Kernel\Entity

Code

public function testStartBatchClear() {

  // Make sure something is imported first.
  $feed = $this
    ->createFeed($this->feedType
    ->id(), [
    'source' => $this
      ->resourcesPath() . '/rss/googlenewstz.rss2',
  ]);
  $feed
    ->import();

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

  // Start batch clear.
  $feed
    ->startBatchClear();

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