function AggregatorTestBase::createFeed

Create an aggregator feed (simulate form submission on admin/config/services/aggregator/add/feed).

Parameters

$feed_url: If given, feed will be created with this URL, otherwise /rss.xml will be used.

Return value

$feed Full feed object if possible.

See also

getFeedEditArray()

13 calls to AggregatorTestBase::createFeed()
AddFeedTest::testAddFeed in drupal/core/modules/aggregator/lib/Drupal/aggregator/Tests/AddFeedTest.php
Create a feed, ensure that it is unique, check the source, and delete the feed.
AddFeedTest::testAddLongFeed in drupal/core/modules/aggregator/lib/Drupal/aggregator/Tests/AddFeedTest.php
Tests feeds with very long URLs.
AggregatorCronTest::testCron in drupal/core/modules/aggregator/lib/Drupal/aggregator/Tests/AggregatorCronTest.php
Add feeds update them on cron.
AggregatorRenderingTest::testBlockLinks in drupal/core/modules/aggregator/lib/Drupal/aggregator/Tests/AggregatorRenderingTest.php
Add a feed block to the page and checks its links.
AggregatorRenderingTest::testFeedPage in drupal/core/modules/aggregator/lib/Drupal/aggregator/Tests/AggregatorRenderingTest.php
Create a feed and check that feed's page.

... See full list

File

drupal/core/modules/aggregator/lib/Drupal/aggregator/Tests/AggregatorTestBase.php, line 46
Definition of Drupal\aggregator\Tests\AggregatorTestBase.

Class

AggregatorTestBase
Defines a base class for testing aggregator.module.

Namespace

Drupal\aggregator\Tests

Code

function createFeed($feed_url = NULL) {
  $edit = $this
    ->getFeedEditArray($feed_url);
  $this
    ->drupalPost('admin/config/services/aggregator/add/feed', $edit, t('Save'));
  $this
    ->assertRaw(t('The feed %name has been added.', array(
    '%name' => $edit['title'],
  )), format_string('The feed !name has been added.', array(
    '!name' => $edit['title'],
  )));
  $feed = db_query("SELECT *  FROM {aggregator_feed} WHERE title = :title AND url = :url", array(
    ':title' => $edit['title'],
    ':url' => $edit['url'],
  ))
    ->fetch();
  $this
    ->assertTrue(!empty($feed), 'The feed found in database.');
  return $feed;
}