You are here

public function SecurityAdvisoriesFetcherTest::testShowAdvisories in Drupal 9

Tests contrib advisories that should be displayed.

@dataProvider providerShowAdvisories

Parameters

mixed[] $feed_item: The feed item to test. 'title' and 'link' are omitted from this array because they do not need to vary between test cases.

string|null $existing_version: The existing version of the module.

File

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

Class

SecurityAdvisoriesFetcherTest
@coversDefaultClass \Drupal\system\SecurityAdvisories\SecurityAdvisoriesFetcher

Namespace

Drupal\Tests\system\Kernel\SecurityAdvisories

Code

public function testShowAdvisories(array $feed_item, string $existing_version = NULL) : void {
  $this
    ->setFeedItems([
    $feed_item,
  ]);
  if ($existing_version !== NULL) {
    $this
      ->setExistingProjectVersion($existing_version);
  }
  $links = $this
    ->getAdvisories();
  $this
    ->assertCount(1, $links);
  $this
    ->assertSame('http://example.com', $links[0]
    ->getUrl());
  $this
    ->assertSame('SA title', $links[0]
    ->getTitle());
  $this
    ->assertCount(1, $this->history);
}