You are here

public function FeedsDrushCommandsTest::testImportFeedFailsWhenLocked in Feeds 8.3

Tests that importing a locked feed fails.

File

tests/src/Functional/Commands/FeedsDrushCommandsTest.php, line 146

Class

FeedsDrushCommandsTest
@coversDefaultClass \Drupal\feeds\Commands\FeedsDrushCommands @group feeds

Namespace

Drupal\Tests\feeds\Functional\Commands

Code

public function testImportFeedFailsWhenLocked() {

  // Create a feed.
  $feed = $this
    ->createFeed($this->feedType
    ->id(), [
    'title' => 'Foo',
    'source' => $this
      ->resourcesPath() . '/rss/drupalplanet.rss2',
  ]);

  // Lock feed.
  $feed
    ->lock();

  // Try importing a feed using drush.
  $this
    ->drush('feeds:import', [
    $feed
      ->id(),
  ]);

  // Assert that no nodes got imported.
  $this
    ->assertNodeCount(0);

  // Assert the output.
  $this
    ->assertStringContainsString('The feed became locked before the import could begin', $this
    ->getSimplifiedErrorOutput());
}