function SecurityAdvisoriesFetcherTest::setFeedItems

Same name and namespace in other branches
  1. 11.x core/modules/system/tests/src/Kernel/SecurityAdvisories/SecurityAdvisoriesFetcherTest.php \Drupal\Tests\system\Kernel\SecurityAdvisories\SecurityAdvisoriesFetcherTest::setFeedItems()
  2. 10 core/modules/system/tests/src/Kernel/SecurityAdvisories/SecurityAdvisoriesFetcherTest.php \Drupal\Tests\system\Kernel\SecurityAdvisories\SecurityAdvisoriesFetcherTest::setFeedItems()

Sets the feed items to be returned for the test.

Parameters

mixed[][] $feed_items: The feeds items to test. Every time the http_client makes a request the next item in this array will be returned. For each feed item 'title' and 'link' are omitted because they do not need to vary between test cases.

File

core/modules/system/tests/src/Kernel/SecurityAdvisories/SecurityAdvisoriesFetcherTest.php, line 502

Class

SecurityAdvisoriesFetcherTest
@coversDefaultClass \Drupal\system\SecurityAdvisories\SecurityAdvisoriesFetcher[[api-linebreak]]

Namespace

Drupal\Tests\system\Kernel\SecurityAdvisories

Code

protected function setFeedItems(array $feed_items) : void {
  $responses = [];
  foreach ($feed_items as $feed_item) {
    $feed_item += [
      'title' => 'SA title',
      'link' => 'http://example.com',
    ];
    $responses[] = new Response('200', [], json_encode([
      $feed_item,
    ]));
  }
  $this->setTestFeedResponses($responses);
}

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