From 55d2288b1af6ad30f0ca0a314c763eb7d6f0e3ef Mon Sep 17 00:00:00 2001 From: catch <6915-catch@users.noreply.drupalcode.org> Date: Fri, 22 Nov 2024 11:54:05 +0000 Subject: [PATCH] Issue #3378393 by quietone, xjm, dww: Hardcode security coverage EOL dates for Drupal 10.last-1 and 10.last (cherry picked from commit 6e4863ffb5b9f374f97ccb9912d529688a26fe66) --- .../update/src/ProjectSecurityData.php | 8 +- ...l.sec.10.5.0.xml => drupal.sec.10.6.0.xml} | 24 ++-- ...al.sec.9.5.0.xml => drupal.sec.11.6.0.xml} | 26 ++--- .../update_test/src/Datetime/TestTime.php | 12 ++ .../UpdateSemverCoreSecurityCoverageTest.php | 103 +++++++++--------- 5 files changed, 91 insertions(+), 82 deletions(-) rename core/modules/update/tests/fixtures/release-history/{drupal.sec.10.5.0.xml => drupal.sec.10.6.0.xml} (70%) rename core/modules/update/tests/fixtures/release-history/{drupal.sec.9.5.0.xml => drupal.sec.11.6.0.xml} (62%) diff --git a/core/modules/update/src/ProjectSecurityData.php b/core/modules/update/src/ProjectSecurityData.php index daa21056898..472e408f2be 100644 --- a/core/modules/update/src/ProjectSecurityData.php +++ b/core/modules/update/src/ProjectSecurityData.php @@ -40,13 +40,13 @@ final class ProjectSecurityData { * * @see \Drupal\update\ProjectSecurityRequirement::getDateEndRequirement() */ - const SECURITY_COVERAGE_END_DATE_9_4 = '2023-06-21'; + const SECURITY_COVERAGE_END_DATE_10_5 = '2026-06-17'; - const SECURITY_COVERAGE_ENDING_WARN_DATE_9_4 = '2022-12-14'; + const SECURITY_COVERAGE_ENDING_WARN_DATE_10_5 = '2025-12-10'; - const SECURITY_COVERAGE_END_DATE_9_5 = '2023-11'; + const SECURITY_COVERAGE_END_DATE_10_6 = '2026-12-09'; - const SECURITY_COVERAGE_ENDING_WARN_DATE_9_5 = '2023-05-14'; + const SECURITY_COVERAGE_ENDING_WARN_DATE_10_6 = '2026-06-17'; /** * The existing (currently installed) version of the project. diff --git a/core/modules/update/tests/fixtures/release-history/drupal.sec.10.5.0.xml b/core/modules/update/tests/fixtures/release-history/drupal.sec.10.6.0.xml similarity index 70% rename from core/modules/update/tests/fixtures/release-history/drupal.sec.10.5.0.xml rename to core/modules/update/tests/fixtures/release-history/drupal.sec.10.6.0.xml index 511111f9513..ed980023271 100644 --- a/core/modules/update/tests/fixtures/release-history/drupal.sec.10.5.0.xml +++ b/core/modules/update/tests/fixtures/release-history/drupal.sec.10.6.0.xml @@ -4,26 +4,26 @@ This fixture is used by Drupal\Tests\update\Functional\UpdateSemverCoreTest. It contains 2 releases: -- 10.4.0: testSecurityCoverageMessage() checks EOL date warnings on the Status Report. - 10.5.0: testSecurityCoverageMessage() checks EOL date warnings on the Status Report. +- 10.6.0: testSecurityCoverageMessage() checks EOL date warnings on the Status Report. --> Drupal drupal Drupal - 10.4.,10.5. + 10.5.,10.6. published http://example.com/project/drupal ProjectsDrupal project - Drupal 10.5.0 - 10.5.0 + Drupal 10.6.0 + 10.6.0 published - http://example.com/drupal-10-5-0-release - http://example.com/drupal-10-5-0.tar.gz - 1750424641 + http://example.com/drupal-10-6-0-release + http://example.com/drupal-10-6-0.tar.gz + 1765392356 Release type @@ -36,12 +36,12 @@ It contains 2 releases: - Drupal 10.4.0 - 10.4.0 + Drupal 10.5.0 + 10.5.0 published - http://example.com/drupal-10-4-0-release - http://example.com/drupal-10-4-0.tar.gz - 1730424641 + http://example.com/drupal-10-5-0-release + http://example.com/drupal-10-5-0.tar.gz + 1750272356 Release type diff --git a/core/modules/update/tests/fixtures/release-history/drupal.sec.9.5.0.xml b/core/modules/update/tests/fixtures/release-history/drupal.sec.11.6.0.xml similarity index 62% rename from core/modules/update/tests/fixtures/release-history/drupal.sec.9.5.0.xml rename to core/modules/update/tests/fixtures/release-history/drupal.sec.11.6.0.xml index 282070c81c5..6e8d0e720f8 100644 --- a/core/modules/update/tests/fixtures/release-history/drupal.sec.9.5.0.xml +++ b/core/modules/update/tests/fixtures/release-history/drupal.sec.11.6.0.xml @@ -4,26 +4,26 @@ This fixture is used by Drupal\Tests\update\Functional\UpdateSemverCoreTest. It contains 2 releases: -- 9.4.0: testSecurityCoverageMessage() checks EOL date warnings on the Status Report. -- 9.5.0: testSecurityCoverageMessage() checks EOL date warnings on the Status Report. +- 11.5.0: testSecurityCoverageMessage() checks EOL date warnings on the Status Report. +- 11.6.0: testSecurityCoverageMessage() checks EOL date warnings on the Status Report. --> Drupal drupal Drupal - 9.4.,9.5. + 11.5.,11.6. published http://example.com/project/drupal ProjectsDrupal project - Drupal 9.5.0 - 9.5.0 + Drupal 11.6.0 + 11.6.0 published - http://example.com/drupal-9-5-0-release - http://example.com/drupal-9-5-0.tar.gz - 1670972400 + http://example.com/drupal-11-6-0-release + http://example.com/drupal-11-6-0.tar.gz + 1828291556 Release type @@ -36,12 +36,12 @@ It contains 2 releases: - Drupal 9.4.0 - 9.4.0 + Drupal 11.5.0 + 11.5.0 published - http://example.com/drupal-9-4-0-release - http://example.com/drupal-9-4-0.tar.gz - 1655244000 + http://example.com/drupal-11-5-0-release + http://example.com/drupal-11-5-0.tar.gz + 1813171556 Release type diff --git a/core/modules/update/tests/modules/update_test/src/Datetime/TestTime.php b/core/modules/update/tests/modules/update_test/src/Datetime/TestTime.php index de9e5b86e43..597dfe460f3 100644 --- a/core/modules/update/tests/modules/update_test/src/Datetime/TestTime.php +++ b/core/modules/update/tests/modules/update_test/src/Datetime/TestTime.php @@ -19,4 +19,16 @@ class TestTime extends Time { return parent::getRequestTime(); } + /** + * {@inheritdoc} + */ + public function getCurrentTime() { + // Ensure that request for the current time returns any previously set mock + // date. If a mock date is not set then return the real current time. + if ($mock_date = \Drupal::state()->get('update_test.mock_date', NULL)) { + return \DateTime::createFromFormat('Y-m-d', $mock_date)->getTimestamp(); + } + return parent::getCurrentTime(); + } + } diff --git a/core/modules/update/tests/src/Functional/UpdateSemverCoreSecurityCoverageTest.php b/core/modules/update/tests/src/Functional/UpdateSemverCoreSecurityCoverageTest.php index 59af11165d7..c7aad77146b 100644 --- a/core/modules/update/tests/src/Functional/UpdateSemverCoreSecurityCoverageTest.php +++ b/core/modules/update/tests/src/Functional/UpdateSemverCoreSecurityCoverageTest.php @@ -75,12 +75,9 @@ class UpdateSemverCoreSecurityCoverageTest extends UpdateSemverCoreTestBase { * - drupal.sec.8.2.0_9.0.0.xml * - 8.2.0 * - 9.0.0 - * - drupal.sec.9.5.0.xml - * - 9.4.0 - * - 9.5.0 - * - drupal.sec.10.5.0.xml - * - 10.4.0 + * - drupal.sec.10.6.0.xml * - 10.5.0 + * - 10.6.0 */ protected static function securityCoverageMessageProvider() { $release_coverage_message = 'Visit the release cycle overview for more information on supported releases.'; @@ -160,88 +157,88 @@ class UpdateSemverCoreSecurityCoverageTest extends UpdateSemverCoreTestBase { ], ]; - // Drupal 9.4.x test cases. + // Drupal 10.5.x test cases. $test_cases += [ - // Ensure that a message is displayed during 9.4's active support. - '9.4.0, supported' => [ - 'installed_version' => '9.4.0', - 'fixture' => 'sec.9.5.0', + // Ensure that a message is displayed during 10.5's active support. + '10.5.0, supported' => [ + 'installed_version' => '10.5.0', + 'fixture' => 'sec.10.6.0', 'requirements_section_heading' => 'Checked', - 'message' => "Covered until 2023-Jun-21 $release_coverage_message", - 'mock_date' => '2022-12-13', + 'message' => "Covered until 2026-Jun-17 $release_coverage_message", + 'mock_date' => '2025-06-25', ], // Ensure a warning is displayed if less than six months remain until the - // end of 9.4's security coverage. - '9.4.0, supported, 6 months warn' => [ - 'installed_version' => '9.4.0', - 'fixture' => 'sec.9.5.0', + // end of 10.5's security coverage. + '10.5.0, supported, 6 months warn' => [ + 'installed_version' => '10.5.0', + 'fixture' => 'sec.10.6.0', 'requirements_section_heading' => 'Warnings found', - 'message' => "Covered until 2023-Jun-21 $update_soon_message $release_coverage_message", - 'mock_date' => '2022-12-14', + 'message' => "Covered until 2026-Jun-17 $update_soon_message $release_coverage_message", + 'mock_date' => '2025-12-10', ], ]; // Ensure that the message does not change, including on the last day of // security coverage. - $test_cases['9.4.0, supported, last day warn'] = $test_cases['9.4.0, supported, 6 months warn']; - $test_cases['9.4.0, supported, last day warn']['mock_date'] = '2023-06-20'; + $test_cases['10.5.0, supported, last day warn'] = $test_cases['10.5.0, supported, 6 months warn']; + $test_cases['10.5.0, supported, last day warn']['mock_date'] = '2026-06-16'; - // Ensure that if the 9.4 support window is finished a message is + // Ensure that if the 10.5 support window is finished a message is // displayed. - $test_cases['9.4.0, support over'] = [ - 'installed_version' => '9.4.0', - 'fixture' => 'sec.9.5.0', + $test_cases['10.5.0, support over'] = [ + 'installed_version' => '10.5.0', + 'fixture' => 'sec.10.6.0', 'requirements_section_heading' => 'Errors found', 'message' => "$coverage_ended_message $update_asap_message $release_coverage_message", - 'mock_date' => '2023-06-22', + 'mock_date' => '2026-06-18', ]; - // Drupal 9.5 test cases. - $test_cases['9.5.0, supported'] = [ - 'installed_version' => '9.5.0', - 'fixture' => 'sec.9.5.0', + // Drupal 10.6 test cases. + $test_cases['10.6.0, supported'] = [ + 'installed_version' => '10.6.0', + 'fixture' => 'sec.10.6.0', 'requirements_section_heading' => 'Checked', - 'message' => "Covered until 2023-Nov $release_coverage_message", - 'mock_date' => '2023-01-01', + 'message' => "Covered until 2026-Dec-09 $release_coverage_message", + 'mock_date' => '2026-01-01', ]; // Ensure a warning is displayed if less than six months remain until the - // end of 9.5's security coverage. - $test_cases['9.5.0, supported, 6 months warn'] = [ - 'installed_version' => '9.5.0', - 'fixture' => 'sec.9.5.0', + // end of 10.6's security coverage. + $test_cases['10.6.0, supported, 6 months warn'] = [ + 'installed_version' => '10.6.0', + 'fixture' => 'sec.10.6.0', 'requirements_section_heading' => 'Warnings found', - 'message' => "Covered until 2023-Nov $update_soon_message $release_coverage_message", - 'mock_date' => '2023-05-15', + 'message' => "Covered until 2026-Dec-09 $update_soon_message $release_coverage_message", + 'mock_date' => '2026-06-17', ]; // Ensure that the message does not change, including on the last day of // security coverage. - $test_cases['9.5.0, supported, last day warn'] = $test_cases['9.5.0, supported, 6 months warn']; - $test_cases['9.5.0, supported, last day warn']['mock_date'] = '2023-10-31'; + $test_cases['10.6.0, supported, last day warn'] = $test_cases['10.6.0, supported, 6 months warn']; + $test_cases['10.6.0, supported, last day warn']['mock_date'] = '2026-12-08'; // Ensure that if the support window is finished a message is displayed. - $test_cases['9.5.0, support over'] = [ - 'installed_version' => '9.5.0', - 'fixture' => 'sec.9.5.0', + $test_cases['10.6.0, support over'] = [ + 'installed_version' => '10.6.0', + 'fixture' => 'sec.10.6.0', 'requirements_section_heading' => 'Errors found', 'message' => "$coverage_ended_message $update_asap_message $release_coverage_message", - 'mock_date' => '2023-11-01', + 'mock_date' => '2026-12-10', ]; - // Drupal 9 test cases. + // Drupal 11 test cases. $test_cases += [ - // Ensure the end dates for 9.4 and 9.5 only apply to major version 9. - '10.5.0' => [ - 'installed_version' => '10.5.0', - 'fixture' => 'sec.10.5.0', + // Ensure the end dates for 10.5 and 10.6 only apply to major version 10. + '11.6.0' => [ + 'installed_version' => '11.6.0', + 'fixture' => 'sec.11.6.0', 'requirements_section_heading' => 'Checked', - 'message' => "Covered until 10.7.0 $release_coverage_message", + 'message' => "Covered until 11.8.0 $release_coverage_message", 'mock_date' => '', ], - '10.4.0' => [ - 'installed_version' => '10.4.0', - 'fixture' => 'sec.10.5.0', + '11.5.0' => [ + 'installed_version' => '11.5.0', + 'fixture' => 'sec.11.6.0', 'requirements_section_heading' => 'Warnings found', - 'message' => "Covered until 10.6.0 Update to 10.5 or higher soon to continue receiving security updates. $release_coverage_message", + 'message' => "Covered until 11.7.0 Update to 11.6 or higher soon to continue receiving security updates. $release_coverage_message", 'mock_date' => '', ], ];