You are here

public function AggregatorTestBase::getFeedEditObject in Zircon Profile 8.0

Same name and namespace in other branches
  1. 8 core/modules/aggregator/src/Tests/AggregatorTestBase.php \Drupal\aggregator\Tests\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/src/Tests/AggregatorTestBase.php, line 127
Contains \Drupal\aggregator\Tests\AggregatorTestBase.

Class

AggregatorTestBase
Defines a base class for testing the Aggregator module.

Namespace

Drupal\aggregator\Tests

Code

public function getFeedEditObject($feed_url = NULL, array $values = array()) {
  $feed_name = $this
    ->randomMachineName(10);
  if (!$feed_url) {
    $feed_url = \Drupal::url('view.frontpage.feed_1', array(
      'query' => array(
        'feed' => $feed_name,
      ),
      'absolute' => TRUE,
    ));
  }
  $values += array(
    'title' => $feed_name,
    'url' => $feed_url,
    'refresh' => '900',
  );
  return entity_create('aggregator_feed', $values);
}