From 5450faf3ec305d01c4aa47631ece28cb6123ff1f Mon Sep 17 00:00:00 2001 From: Sergey Biryukov Date: Wed, 29 Dec 2021 16:34:12 +0000 Subject: [PATCH] Tests: Correct the check for the recommended MySQL version in `readme.html`. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This updates the regular expression in the test to retrieve the date of the first, instead of the last, GA release for the recommended MySQL branch, in order to properly track the EOL date. Additionally, as the currently recommended MySQL 5.7 branch moved from active support to extended support on 2020-10-21, and WordPress core is not fully compatible with MySQL 8.0 at this time, this commit increases the “supported” period from 5 to 8 years to include extended support. Follow-up to [31291], [35759], [meta11407], [52420]. See #41490. git-svn-id: https://develop.svn.wordpress.org/trunk@52421 602fd350-edb4-49c9-b593-d223f7449a82 --- tests/phpunit/tests/external-http/basic.php | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/tests/phpunit/tests/external-http/basic.php b/tests/phpunit/tests/external-http/basic.php index 95b7c2d179..f02e8fbcaf 100644 --- a/tests/phpunit/tests/external-http/basic.php +++ b/tests/phpunit/tests/external-http/basic.php @@ -40,10 +40,19 @@ class Tests_External_HTTP_Basic extends WP_UnitTestCase { $response_body = $this->get_response_body( "https://dev.mysql.com/doc/relnotes/mysql/{$matches[1]}/en/" ); - preg_match( '#(\d{4}-\d{2}-\d{2}), General Availability#', $response_body, $mysqlmatches ); + // Retrieve the date of the first GA release for the recommended branch. + preg_match( '#.*(\d{4}-\d{2}-\d{2}), General Availability#s', $response_body, $mysqlmatches ); - // Per https://www.mysql.com/support/, Oracle actively supports MySQL releases for 5 years from GA release. - $mysql_eol = strtotime( $mysqlmatches[1] . ' +5 years' ); + /* + * Per https://www.mysql.com/support/, Oracle actively supports MySQL releases for 5 years from GA release. + * + * The currently recommended MySQL 5.7 branch moved from active support to extended support on 2020-10-21. + * As WordPress core is not fully compatible with MySQL 8.0 at this time, the "supported" period here + * is increased to 8 years to include extended support. + * + * TODO: Reduce this back to 5 years once MySQL 8.0 compatibility is achieved. + */ + $mysql_eol = strtotime( $mysqlmatches[1] . ' +8 years' ); $this->assertLessThan( $mysql_eol, time(), "readme.html's Recommended MySQL version is too old. Remember to update the WordPress.org Requirements page, too." ); }