You are here

public function FeedsDrushCommandsTest::testEnableFeed in Feeds 8.3

@covers ::enableFeed

File

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

Class

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

Namespace

Drupal\Tests\feeds\Functional\Commands

Code

public function testEnableFeed() {

  // Create a feed that is not enabled.
  $feed = $this
    ->createFeed($this->feedType
    ->id(), [
    'title' => 'Foo',
    'status' => FALSE,
  ]);
  $this
    ->assertFalse((bool) $feed->status->value);

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

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

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