You are here

private function SecurityAdvisoryTest::assertStatusReportLinks in Drupal 9

Asserts the correct links appear on the status report page.

Parameters

string[] $expected_link_texts: The expected links' text.

int $error_or_warning: Whether the links are a warning or an error. Should be one of the REQUIREMENT_* constants.

1 call to SecurityAdvisoryTest::assertStatusReportLinks()
SecurityAdvisoryTest::testPsa in core/modules/system/tests/src/Functional/SecurityAdvisories/SecurityAdvisoryTest.php
Tests that a security advisory is displayed.

File

core/modules/system/tests/src/Functional/SecurityAdvisories/SecurityAdvisoryTest.php, line 245

Class

SecurityAdvisoryTest
Tests of security advisories functionality.

Namespace

Drupal\Tests\system\Functional\SecurityAdvisories

Code

private function assertStatusReportLinks(array $expected_link_texts, int $error_or_warning) : void {
  $this
    ->drupalGet(Url::fromRoute('system.status'));
  $assert = $this
    ->assertSession();
  $selector = 'h3#' . ($error_or_warning === REQUIREMENT_ERROR ? 'error' : 'warning') . ' ~ details.system-status-report__entry:contains("Critical security announcements")';
  $assert
    ->elementExists('css', $selector);
  foreach ($expected_link_texts as $expected_link_text) {
    $assert
      ->linkExists($expected_link_text);
  }
}