function AggregatorTestBase::getFeedEditObject
Same name in this branch
- 8.9.x core/modules/aggregator/src/Tests/AggregatorTestBase.php \Drupal\aggregator\Tests\AggregatorTestBase::getFeedEditObject()
Same name in other branches
- 9 core/modules/aggregator/tests/src/Functional/AggregatorTestBase.php \Drupal\Tests\aggregator\Functional\AggregatorTestBase::getFeedEditObject()
Returns a randomly generated feed edit object.
Parameters
string $feed_url: (optional) If given, feed will be created with this URL, otherwise /rss.xml will be used. Defaults to NULL.
array $values: (optional) Default values to initialize object properties with.
Return value
\Drupal\aggregator\FeedInterface A feed object.
File
-
core/
modules/ aggregator/ tests/ src/ Functional/ AggregatorTestBase.php, line 140
Class
- AggregatorTestBase
- Defines a base class for testing the Aggregator module.
Namespace
Drupal\Tests\aggregator\FunctionalCode
public function getFeedEditObject($feed_url = NULL, array $values = []) {
$feed_name = $this->randomMachineName(10);
if (!$feed_url) {
$feed_url = Url::fromRoute('view.frontpage.feed_1', [
'query' => [
'feed' => $feed_name,
],
'absolute' => TRUE,
])->toString();
}
$values += [
'title' => $feed_name,
'url' => $feed_url,
'refresh' => '900',
];
return Feed::create($values);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.