function UpdateCoreTest::testSecurityCoverageMessage
Tests the security coverage messages for Drupal core versions.
@dataProvider securityCoverageMessageProvider
Parameters
string $installed_version: The installed Drupal version to test.
string $fixture: The test fixture that contains the test XML.
string $requirements_section_heading: The requirements section heading.
string $message: The expected coverage message.
string $mock_date: The mock date to use if needed in the format CCYY-MM-DD. If an empty string is provided, no mock date will be used.
File
-
core/
modules/ update/ tests/ src/ Functional/ UpdateCoreTest.php, line 420
Class
- UpdateCoreTest
- Tests the Update Manager module through a series of functional tests using mock XML data.
Namespace
Drupal\Tests\update\FunctionalCode
public function testSecurityCoverageMessage($installed_version, $fixture, $requirements_section_heading, $message, $mock_date) {
\Drupal::state()->set('update_test.mock_date', $mock_date);
$this->setSystemInfo($installed_version);
$this->refreshUpdateStatus([
'drupal' => $fixture,
]);
$this->drupalGet('admin/reports/status');
if (empty($requirements_section_heading)) {
$this->assertSession()
->pageTextNotContains('Drupal core security coverage');
return;
}
$all_requirements_details = $this->getSession()
->getPage()
->findAll('css', 'details.system-status-report__entry:contains("Drupal core security coverage")');
// Ensure we only have 1 security message section.
$this->assertCount(1, $all_requirements_details);
$requirements_details = $all_requirements_details[0];
// Ensure that messages are under the correct heading which could be
// 'Checked', 'Warnings found', or 'Errors found'.
$requirements_section_element = $requirements_details->getParent();
$this->assertCount(1, $requirements_section_element->findAll('css', "h3:contains('{$requirements_section_heading}')"));
$actual_message = $requirements_details->find('css', 'div.system-status-report__entry__value')
->getText();
$this->assertNotEmpty($actual_message);
$this->assertEquals($message, $actual_message);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.