You are here

public function FeedsDrushCommandsTest::testDisableFeed in Feeds 8.3

@covers ::disableFeed

File

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

Class

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

Namespace

Drupal\Tests\feeds\Functional\Commands

Code

public function testDisableFeed() {

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

  // Disable the feed using drush.
  $this
    ->drush('feeds:disable', [
    $feed
      ->id(),
  ]);

  // Assert that the feed is now disabled.
  $feed = $this
    ->reloadEntity($feed);
  $this
    ->assertFalse((bool) $feed->status->value);
  $this
    ->assertStringContainsString('The feed "Foo" has been disabled.', $this
    ->getErrorOutput());

  // Try to disable it again.
  $this
    ->drush('feeds:disable', [
    $feed
      ->id(),
  ]);
  $this
    ->assertStringContainsString('This feed is already disabled.', $this
    ->getErrorOutput());
}