You are here

public function AggregatorTestBase::getFeedEditArray in Drupal 9

Same name and namespace in other branches
  1. 8 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.

3 calls to AggregatorTestBase::getFeedEditArray()
AggregatorTestBase::createFeed in core/modules/aggregator/tests/src/Functional/AggregatorTestBase.php
Creates an aggregator feed.
ImportOpmlTest::submitImportForm in core/modules/aggregator/tests/src/Functional/ImportOpmlTest.php
Submits form with invalid, empty, and valid OPML files.
UpdateFeedTest::testUpdateFeed in core/modules/aggregator/tests/src/Functional/UpdateFeedTest.php
Creates a feed and attempts to update it.

File

core/modules/aggregator/tests/src/Functional/AggregatorTestBase.php, line 117

Class

AggregatorTestBase
Defines a base class for testing the Aggregator module.

Namespace

Drupal\Tests\aggregator\Functional

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;
}