You are here

public function FeedsDrushCommandsTest::testListFeeds in Feeds 8.3

@covers ::listFeeds

File

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

Class

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

Namespace

Drupal\Tests\feeds\Functional\Commands

Code

public function testListFeeds() {

  // Create a feed.
  $feed = $this
    ->createFeed($this->feedType
    ->id());

  // Execute drush command to list feeds.
  $this
    ->drush('feeds:list-feeds');
  $output = $this
    ->getOutputAsList();

  // Assert columns get displayed.
  $expected_columns = [
    'Feed type',
    'Feed ID',
    'Title',
    'Last imported',
    'Next import',
    'Feed source',
    'Item count',
    'Status',
  ];
  foreach ($expected_columns as $column) {
    $this
      ->assertStringContainsString($column, $output[1]);
  }

  // Assert that the feed gets displayed.
  // @todo assert display of dates.
  $values = [
    $this->feedType
      ->id(),
    $feed
      ->label(),
  ];
  foreach ($values as $value) {
    $this
      ->assertStringContainsString($value, $output[3]);
  }
}