function AggregatorTestBase::getFeedEditArray

Same name in this branch
  1. 8.9.x core/modules/aggregator/tests/src/Functional/AggregatorTestBase.php \Drupal\Tests\aggregator\Functional\AggregatorTestBase::getFeedEditArray()
Same name in other branches
  1. 9 core/modules/aggregator/tests/src/Functional/AggregatorTestBase.php \Drupal\Tests\aggregator\Functional\AggregatorTestBase::getFeedEditArray()

Returns a randomly generated feed edit array.

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

array A feed array.

1 call to AggregatorTestBase::getFeedEditArray()
AggregatorTestBase::createFeed in core/modules/aggregator/src/Tests/AggregatorTestBase.php
Creates an aggregator feed.

File

core/modules/aggregator/src/Tests/AggregatorTestBase.php, line 114

Class

AggregatorTestBase
Defines a base class for testing the Aggregator module.

Namespace

Drupal\aggregator\Tests

Code

public function getFeedEditArray($feed_url = NULL, array $edit = []) {
    $feed_name = $this->randomMachineName(10);
    if (!$feed_url) {
        $feed_url = Url::fromRoute('view.frontpage.feed_1', [], [
            'query' => [
                'feed' => $feed_name,
            ],
            'absolute' => TRUE,
        ])->toString();
    }
    $edit += [
        'title[0][value]' => $feed_name,
        'url[0][value]' => $feed_url,
        'refresh' => '900',
    ];
    return $edit;
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.