function AddFeedTest::testAddFeed

Creates and ensures that a feed is unique, checks source, and deletes feed.

File

drupal/core/modules/aggregator/lib/Drupal/aggregator/Tests/AddFeedTest.php, line 25
Definition of Drupal\aggregator\Tests\AddFeedTest.

Class

AddFeedTest
Tests adding aggregator feeds.

Namespace

Drupal\aggregator\Tests

Code

function testAddFeed() {
  $feed = $this
    ->createFeed();

  // Check feed data.
  $this
    ->assertEqual($this
    ->getUrl(), url('admin/config/services/aggregator/add/feed', array(
    'absolute' => TRUE,
  )), 'Directed to correct url.');
  $this
    ->assertTrue($this
    ->uniqueFeed($feed
    ->label(), $feed->url->value), 'The feed is unique.');

  // Check feed source.
  $this
    ->drupalGet('aggregator/sources/' . $feed
    ->id());
  $this
    ->assertResponse(200, 'Feed source exists.');
  $this
    ->assertText($feed
    ->label(), 'Page title');
  $this
    ->drupalGet('aggregator/sources/' . $feed
    ->id() . '/categorize');
  $this
    ->assertResponse(200, 'Feed categorization page exists.');
  $this
    ->assertText($feed
    ->label());

  // Delete feed.
  $this
    ->deleteFeed($feed);
}