function SecurityAdvisoriesFetcherTest::setFeedItems

Same name and namespace in other branches
  1. 9 core/modules/system/tests/src/Kernel/SecurityAdvisories/SecurityAdvisoriesFetcherTest.php \Drupal\Tests\system\Kernel\SecurityAdvisories\SecurityAdvisoriesFetcherTest::setFeedItems()
  2. 11.x 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.

3 calls to SecurityAdvisoriesFetcherTest::setFeedItems()
SecurityAdvisoriesFetcherTest::testIgnoreAdvisories in core/modules/system/tests/src/Kernel/SecurityAdvisories/SecurityAdvisoriesFetcherTest.php
Tests advisories that should be ignored.
SecurityAdvisoriesFetcherTest::testIntervalConfigUpdate in core/modules/system/tests/src/Kernel/SecurityAdvisories/SecurityAdvisoriesFetcherTest.php
Tests that the stored advisories response is deleted on interval decrease.
SecurityAdvisoriesFetcherTest::testShowAdvisories in core/modules/system/tests/src/Kernel/SecurityAdvisories/SecurityAdvisoriesFetcherTest.php
Tests contrib advisories that should be displayed.

File

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

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.