public function UpdateSemverCoreTest::securityCoverageMessageProvider in Drupal 9
Data provider for testSecurityCoverageMessage().
These test cases rely on the following fixtures containing the following releases:
- drupal.sec.2.0_3.0-rc1.xml
- 8.2.0
- 8.3.0-rc1
- drupal.sec.2.0.xml
- 8.2.0
- drupal.sec.2.0_9.0.0.xml
- 8.2.0
- 9.0.0
- drupal.sec.9.0.xml
- 8.9.0
- drupal.sec.9.9.0.xml
- 9.9.0
File
- core/
modules/ update/ tests/ src/ Functional/ UpdateSemverCoreTest.php, line 107
Class
- UpdateSemverCoreTest
- Tests the Update Manager module through a series of functional tests using mock XML data.
Namespace
Drupal\Tests\update\FunctionalCode
public function securityCoverageMessageProvider() {
$release_coverage_message = 'Visit the release cycle overview for more information on supported releases.';
$coverage_ended_message = 'Coverage has ended';
$update_asap_message = 'Update to a supported minor as soon as possible to continue receiving security updates.';
$update_soon_message = 'Update to a supported minor version soon to continue receiving security updates.';
$test_cases = [
'8.0.0, unsupported' => [
'installed_version' => '8.0.0',
'fixture' => 'sec.2.0_3.0-rc1',
'requirements_section_heading' => 'Errors found',
'message' => "{$coverage_ended_message} {$update_asap_message} {$release_coverage_message}",
'mock_date' => '',
],
'8.1.0, supported with 3rc' => [
'installed_version' => '8.1.0',
'fixture' => 'sec.2.0_3.0-rc1',
'requirements_section_heading' => 'Warnings found',
'message' => "Covered until 8.3.0 Update to 8.2 or higher soon to continue receiving security updates. {$release_coverage_message}",
'mock_date' => '',
],
'8.1.0, supported' => [
'installed_version' => '8.1.0',
'fixture' => 'sec.2.0',
'requirements_section_heading' => 'Warnings found',
'message' => "Covered until 8.3.0 Update to 8.2 or higher soon to continue receiving security updates. {$release_coverage_message}",
'mock_date' => '',
],
'8.2.0, supported with 3rc' => [
'installed_version' => '8.2.0',
'fixture' => 'sec.2.0_3.0-rc1',
'requirements_section_heading' => 'Checked',
'message' => "Covered until 8.4.0 {$release_coverage_message}",
'mock_date' => '',
],
'8.2.0, supported' => [
'installed_version' => '8.2.0',
'fixture' => 'sec.2.0',
'requirements_section_heading' => 'Checked',
'message' => "Covered until 8.4.0 {$release_coverage_message}",
'mock_date' => '',
],
// Ensure we don't show messages for pre-release or dev versions.
'8.2.0-beta2, no message' => [
'installed_version' => '8.2.0-beta2',
'fixture' => 'sec.2.0_3.0-rc1',
'requirements_section_heading' => '',
'message' => '',
'mock_date' => '',
],
'8.1.0-dev, no message' => [
'installed_version' => '8.1.0-dev',
'fixture' => 'sec.2.0_3.0-rc1',
'requirements_section_heading' => '',
'message' => '',
'mock_date' => '',
],
// Ensures the message is correct if the next major version has been
// released and the additional minors indicated by
// CORE_MINORS_WITH_SECURITY_COVERAGE minors have been released.
'8.0.0, 9 unsupported' => [
'installed_version' => '8.0.0',
'fixture' => 'sec.2.0_9.0.0',
'requirements_section_heading' => 'Errors found',
'message' => "{$coverage_ended_message} {$update_asap_message} {$release_coverage_message}",
'mock_date' => '',
],
// Ensures the message is correct if the next major version has been
// released and the additional minors indicated by
// CORE_MINORS_WITH_SECURITY_COVERAGE minors have not been released.
'8.2.0, 9 warning' => [
'installed_version' => '8.2.0',
'fixture' => 'sec.2.0_9.0.0',
'requirements_section_heading' => 'Warnings found',
'message' => "Covered until 8.4.0 Update to 8.3 or higher soon to continue receiving security updates. {$release_coverage_message}",
'mock_date' => '',
],
];
// Drupal 8.8.x test cases.
$test_cases += [
// Ensure that a message is displayed during 8.8's active support.
'8.8.0, supported' => [
'installed_version' => '8.8.0',
'fixture' => 'sec.9.0',
'requirements_section_heading' => 'Checked',
'message' => "Covered until 2020-Dec-02 {$release_coverage_message}",
'mock_date' => '2020-06-01',
],
// Ensure a warning is displayed if less than six months remain until the
// end of 8.8's security coverage.
'8.8.0, supported, 6 months warn' => [
'installed_version' => '8.8.0',
'fixture' => 'sec.9.0',
'requirements_section_heading' => 'Warnings found',
'message' => "Covered until 2020-Dec-02 {$update_soon_message} {$release_coverage_message}",
'mock_date' => '2020-06-02',
],
];
// Ensure that the message does not change, including on the last day of
// security coverage.
$test_cases['8.8.0, supported, last day warn'] = $test_cases['8.8.0, supported, 6 months warn'];
$test_cases['8.8.0, supported, last day warn']['mock_date'] = '2020-12-01';
// Ensure that if the 8.8 support window is finished a message is
// displayed.
$test_cases['8.8.0, support over'] = [
'installed_version' => '8.8.0',
'fixture' => 'sec.9.0',
'requirements_section_heading' => 'Errors found',
'message' => "{$coverage_ended_message} {$update_asap_message} {$release_coverage_message}",
'mock_date' => '2020-12-02',
];
// Drupal 8.9 LTS test cases.
$test_cases['8.9.0, lts supported'] = [
'installed_version' => '8.9.0',
'fixture' => 'sec.9.0',
'requirements_section_heading' => 'Checked',
'message' => "Covered until 2021-Nov {$release_coverage_message}",
'mock_date' => '2021-01-01',
];
// Ensure that the message does not change, including on the last day of
// security coverage.
$test_cases['8.9.0, lts supported, last day'] = $test_cases['8.9.0, lts supported'];
$test_cases['8.9.0, lts supported, last day']['mock_date'] = '2021-10-31';
// Ensure that if LTS support window is finished a message is displayed.
$test_cases['8.9.0, lts support over'] = [
'installed_version' => '8.9.0',
'fixture' => 'sec.9.0',
'requirements_section_heading' => 'Errors found',
'message' => "{$coverage_ended_message} {$update_asap_message} {$release_coverage_message}",
'mock_date' => '2021-11-01',
];
// Drupal 9 test cases.
$test_cases += [
// Ensure the end dates for 8.8 and 8.9 only apply to major version 8.
'9.9.0' => [
'installed_version' => '9.9.0',
'fixture' => 'sec.9.9.0',
'requirements_section_heading' => 'Checked',
'message' => "Covered until 9.11.0 {$release_coverage_message}",
'mock_date' => '',
],
'9.8.0' => [
'installed_version' => '9.8.0',
'fixture' => 'sec.9.9.0',
'requirements_section_heading' => 'Warnings found',
'message' => "Covered until 9.10.0 Update to 9.9 or higher soon to continue receiving security updates. {$release_coverage_message}",
'mock_date' => '',
],
];
return $test_cases;
}