Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 12 additions & 10 deletions tests/phpunit/tests/readme.php
Original file line number Diff line number Diff line change
Expand Up @@ -67,22 +67,24 @@ public function test_readme_mariadb_version() {
// This test is designed to only run on trunk.
$this->skipOnAutomatedBranches();

$this->markTestSkipped(
'Temporarily disabled. MariaDB has changed the layout and verbiage of their release documentation pages.'
);

$readme = file_get_contents( ABSPATH . 'readme.html' );

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

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

// Retrieve the date of the first stable release for the recommended branch.
preg_match( '#.*Stable.*?(\d{2} [A-Za-z]{3} \d{4})#s', $response_body, $mariadb_matches );
foreach ( $releases['major_releases'] as $release ) {
if ( isset( $release['release_id'] ) && $release['release_id'] === $matches[1] ) {
$mariadb_eol = $release['release_eol_date'];
}
}

// If the release ID is not found the version is unsupported.
if ( ! isset( $mariadb_eol ) ) {
$this->fail( "{$matches[1]} is not included in MariaDB's list of supported versions. Remember to update the WordPress.org Requirements page, too." );
}

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

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