You are here

public function FeedListBuilderTest::testUi in Feeds 8.3

Tests the feed listing page with admin privileges.

File

tests/src/Functional/FeedListBuilderTest.php, line 15

Class

FeedListBuilderTest
Tests the feed listing page.

Namespace

Drupal\Tests\feeds\Functional

Code

public function testUi() {

  // Add a feed type.
  $feed_type = $this
    ->createFeedType();

  // Add a feed.
  $this
    ->createFeed($feed_type
    ->id(), [
    'title' => 'My feed',
    'source' => $this
      ->resourcesUrl() . '/rss/googlenewstz.rss2',
  ]);

  // Go to the feed listing page.
  $this
    ->drupalGet('admin/content/feed');
  $session = $this
    ->assertSession();

  // Assert that there are no warnings nor errors displayed.
  $this
    ->assertNoWarnings();

  // Assert the feed listed with the expected links.
  $session
    ->pageTextContains('My feed');
  $session
    ->linkByHrefExists('/feed/1');
  $session
    ->linkExists('Edit');
  $session
    ->linkByHrefExists('/feed/1/edit');
  $session
    ->linkExists('Import');
  $session
    ->linkByHrefExists('/feed/1/import');
  $session
    ->linkExists('Import in background');
  $session
    ->linkByHrefExists('/feed/1/schedule-import');
  $session
    ->linkExists('Delete items');
  $session
    ->linkByHrefExists('/feed/1/delete-items');
}