Skip to content

Commit 4253160

Browse files
committed
Tests: Fix test that checks MySQL version recommendation.
A test in the `external-http` group that detects when the recommended version of MySQL is too old is failing due to an upstream change to the content of version documentation pages. Because the required information is no longer on the page, this switches to using the public API from endoflife.date. This site is an open source (MIT licensed) resource that is actively maintained. Props peterwilsoncc. See #64894. git-svn-id: https://develop.svn.wordpress.org/trunk@62170 602fd350-edb4-49c9-b593-d223f7449a82
1 parent 993b89d commit 4253160

1 file changed

Lines changed: 9 additions & 4 deletions

File tree

tests/phpunit/tests/readme.php

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,10 +36,15 @@ public function test_readme_mysql_version() {
3636

3737
preg_match( '#Recommendations.*MySQL</a> version <strong>([0-9.]*)#s', $readme, $matches );
3838

39-
$response_body = $this->get_response_body( "https://dev.mysql.com/doc/relnotes/mysql/{$matches[1]}/en/" );
39+
$response_body = json_decode( $this->get_response_body( 'https://endoflife.date/api/mysql.json' ) );
40+
$eol_date = '';
4041

41-
// Retrieve the date of the first GA release for the recommended branch.
42-
preg_match( '#.*(\d{4}-\d{2}-\d{2}), General Availability#s', $response_body, $mysql_matches );
42+
foreach ( $response_body as $version ) {
43+
if ( $version->cycle === $matches[1] && false !== $version->eol ) {
44+
$eol_date = $version->eol;
45+
break;
46+
}
47+
}
4348

4449
/*
4550
* Per https://www.mysql.com/support/, Oracle actively supports MySQL releases for 5 years from GA release.
@@ -50,7 +55,7 @@ public function test_readme_mysql_version() {
5055
*
5156
* TODO: Reduce this back to 5 years once MySQL 8.1 compatibility is achieved.
5257
*/
53-
$mysql_eol = gmdate( 'Y-m-d', strtotime( $mysql_matches[1] . ' +8 years' ) );
58+
$mysql_eol = gmdate( 'Y-m-d', strtotime( $eol_date . ' +8 years' ) );
5459
$current_date = gmdate( 'Y-m-d' );
5560

5661
$this->assertLessThan( $mysql_eol, $current_date, "readme.html's Recommended MySQL version is too old. Remember to update the WordPress.org Requirements page, too." );

0 commit comments

Comments
 (0)