public function AggregatorTestBase::createFeed in Zircon Profile 8
Same name and namespace in other branches
- 8.0 core/modules/aggregator/src/Tests/AggregatorTestBase.php \Drupal\aggregator\Tests\AggregatorTestBase::createFeed()
Creates an aggregator feed.
This method simulates the form submission on path aggregator/sources/add.
Parameters
string $feed_url: (optional) If given, feed will be created with this URL, otherwise /rss.xml will be used. Defaults to NULL.
array $edit: Array with additional form fields.
Return value
\Drupal\aggregator\FeedInterface Full feed object if possible.
See also
getFeedEditArray()
20 calls to AggregatorTestBase::createFeed()
- AddFeedTest::testAddFeed in core/
modules/ aggregator/ src/ Tests/ AddFeedTest.php - Creates and ensures that a feed is unique, checks source, and deletes feed.
- AddFeedTest::testAddLongFeed in core/
modules/ aggregator/ src/ Tests/ AddFeedTest.php - Tests feeds with very long URLs.
- AddFeedTest::testFeedLabelEscaping in core/
modules/ aggregator/ src/ Tests/ AddFeedTest.php - Ensures that the feed label is escaping when rendering the feed icon.
- AggregatorAdminTest::testOverviewPage in core/
modules/ aggregator/ src/ Tests/ AggregatorAdminTest.php - Tests the overview page.
- AggregatorCronTest::testCron in core/
modules/ aggregator/ src/ Tests/ AggregatorCronTest.php - Adds feeds and updates them via cron process.
File
- core/
modules/ aggregator/ src/ Tests/ AggregatorTestBase.php, line 66 - Contains \Drupal\aggregator\Tests\AggregatorTestBase.
Class
- AggregatorTestBase
- Defines a base class for testing the Aggregator module.
Namespace
Drupal\aggregator\TestsCode
public function createFeed($feed_url = NULL, array $edit = array()) {
$edit = $this
->getFeedEditArray($feed_url, $edit);
$this
->drupalPostForm('aggregator/sources/add', $edit, t('Save'));
$this
->assertRaw(t('The feed %name has been added.', array(
'%name' => $edit['title[0][value]'],
)), format_string('The feed @name has been added.', array(
'@name' => $edit['title[0][value]'],
)));
$fid = db_query("SELECT fid FROM {aggregator_feed} WHERE title = :title AND url = :url", array(
':title' => $edit['title[0][value]'],
':url' => $edit['url[0][value]'],
))
->fetchField();
$this
->assertTrue(!empty($fid), 'The feed found in database.');
return Feed::load($fid);
}