Skip to content

Commit ebace79

Browse files
committed
Database: Reinstate test for MariaDB version in readme.
Updates the test to use the MariaDB REST API endpoint of supported versions. A version is considered EOL if it has passed the listed date or is not included in the API response. Follow up to [60313]. Props desrosj, johnbillion, skithund. Fixes #63586. git-svn-id: https://develop.svn.wordpress.org/trunk@60329 602fd350-edb4-49c9-b593-d223f7449a82
1 parent d50235c commit ebace79

File tree

1 file changed

+12
-10
lines changed

1 file changed

+12
-10
lines changed

tests/phpunit/tests/readme.php

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -67,22 +67,24 @@ public function test_readme_mariadb_version() {
6767
// This test is designed to only run on trunk.
6868
$this->skipOnAutomatedBranches();
6969

70-
$this->markTestSkipped(
71-
'Temporarily disabled. MariaDB has changed the layout and verbiage of their release documentation pages.'
72-
);
73-
7470
$readme = file_get_contents( ABSPATH . 'readme.html' );
7571

7672
preg_match( '#Recommendations.*MariaDB</a> version <strong>([0-9.]*)#s', $readme, $matches );
77-
$matches[1] = str_replace( '.', '', $matches[1] );
7873

79-
$response_body = $this->get_response_body( "https://mariadb.com/kb/en/release-notes-mariadb-{$matches[1]}-series/" );
74+
$response_body = $this->get_response_body( 'https://downloads.mariadb.org/rest-api/mariadb/' );
75+
$releases = json_decode( $response_body, true );
8076

81-
// Retrieve the date of the first stable release for the recommended branch.
82-
preg_match( '#.*Stable.*?(\d{2} [A-Za-z]{3} \d{4})#s', $response_body, $mariadb_matches );
77+
foreach ( $releases['major_releases'] as $release ) {
78+
if ( isset( $release['release_id'] ) && $release['release_id'] === $matches[1] ) {
79+
$mariadb_eol = $release['release_eol_date'];
80+
}
81+
}
82+
83+
// If the release ID is not found the version is unsupported.
84+
if ( ! isset( $mariadb_eol ) ) {
85+
$this->fail( "{$matches[1]} is not included in MariaDB's list of supported versions. Remember to update the WordPress.org Requirements page, too." );
86+
}
8387

84-
// Per https://mariadb.org/about/#maintenance-policy, MariaDB releases are supported for 5 years.
85-
$mariadb_eol = gmdate( 'Y-m-d', strtotime( $mariadb_matches[1] . ' +5 years' ) );
8688
$current_date = gmdate( 'Y-m-d' );
8789

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

0 commit comments

Comments
 (0)