Tests: Improve the assertions in recommended MySQL and MariaDB version tests.

Comparing human-readable dates instead of numeric timestamps gives identical results, but makes the message more clear in case of failure.

Follow-up to [33946], [52418], [52421], [52424].

See #55791, #55652.

git-svn-id: https://develop.svn.wordpress.org/trunk@53433 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Sergey Biryukov 2022-05-23 14:07:47 +00:00
parent 214d4a9073
commit 1d62e1f2fb

View File

@ -52,9 +52,10 @@ class Tests_External_HTTP_Basic extends WP_UnitTestCase {
*
* TODO: Reduce this back to 5 years once MySQL 8.0 compatibility is achieved.
*/
$mysql_eol = strtotime( $mysql_matches[1] . ' +8 years' );
$mysql_eol = gmdate( 'Y-m-d', strtotime( $mysql_matches[1] . ' +8 years' ) );
$current_date = gmdate( 'Y-m-d' );
$this->assertLessThan( $mysql_eol, time(), "readme.html's Recommended MySQL version is too old. Remember to update the WordPress.org Requirements page, too." );
$this->assertLessThan( $mysql_eol, $current_date, "readme.html's Recommended MySQL version is too old. Remember to update the WordPress.org Requirements page, too." );
}
/**
@ -84,9 +85,10 @@ class Tests_External_HTTP_Basic extends WP_UnitTestCase {
preg_match( '#.*Stable.*?(\d{2} [A-Za-z]{3} \d{4})#s', $response_body, $mariadb_matches );
// Per https://mariadb.org/about/#maintenance-policy, MariaDB releases are supported for 5 years.
$mariadb_eol = strtotime( $mariadb_matches[1] . ' +5 years' );
$mariadb_eol = gmdate( 'Y-m-d', strtotime( $mariadb_matches[1] . ' +5 years' ) );
$current_date = gmdate( 'Y-m-d' );
$this->assertLessThan( $mariadb_eol, time(), "readme.html's Recommended MariaDB version is too old. Remember to update the WordPress.org Requirements page, too." );
$this->assertLessThan( $mariadb_eol, $current_date, "readme.html's Recommended MariaDB version is too old. Remember to update the WordPress.org Requirements page, too." );
}
/**