private function SecurityAdvisoryTest::assertAdminPageLinks in Drupal 10
Same name and namespace in other branches
- 9 core/modules/system/tests/src/Functional/SecurityAdvisories/SecurityAdvisoryTest.php \Drupal\Tests\system\Functional\SecurityAdvisories\SecurityAdvisoryTest::assertAdminPageLinks()
Asserts the correct links appear on an admin page.
@internal
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::assertAdminPageLinks()
- 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 223
Class
- SecurityAdvisoryTest
- Tests of security advisories functionality.
Namespace
Drupal\Tests\system\Functional\SecurityAdvisoriesCode
private function assertAdminPageLinks(array $expected_link_texts, int $error_or_warning) : void {
$assert = $this
->assertSession();
$this
->drupalGet(Url::fromRoute('system.admin'));
if ($error_or_warning === REQUIREMENT_ERROR) {
$assert
->pageTextContainsOnce('Error message');
$assert
->pageTextNotContains('Warning message');
}
else {
$assert
->pageTextNotContains('Error message');
$assert
->pageTextContainsOnce('Warning message');
}
foreach ($expected_link_texts as $expected_link_text) {
$assert
->linkExists($expected_link_text);
}
}