From f921391922076e558be59ad8caf89dfb0e506554 Mon Sep 17 00:00:00 2001 From: Gary Pendergast Date: Tue, 8 Sep 2015 03:23:29 +0000 Subject: [PATCH] Tests: Check that `readme.html` is recommending an actively supported version of MySQL. Per the MySQL support guidelines (https://www.mysql.com/support/), Oracle provides active support for MySQL releases for 5 years from the General Availality release. See #33758. git-svn-id: https://develop.svn.wordpress.org/trunk@33946 602fd350-edb4-49c9-b593-d223f7449a82 --- tests/phpunit/tests/basic.php | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/tests/phpunit/tests/basic.php b/tests/phpunit/tests/basic.php index c0703ee0ee..bab2534fa7 100644 --- a/tests/phpunit/tests/basic.php +++ b/tests/phpunit/tests/basic.php @@ -38,6 +38,21 @@ class Tests_Basic extends WP_UnitTestCase { preg_match_all( '#\s*\s*]*>\s*([0-9.]*)#s', $php, $phpmatches ); $this->assertContains( $matches[1], $phpmatches[1], "readme.html's Recommended PHP version is too old. Remember to update the WordPress.org Requirements page, too." ); + + preg_match( '#Recommendations.*MySQL version ([0-9.]*)#s', $readme, $matches ); + + $response = wp_remote_get( "https://dev.mysql.com/doc/relnotes/mysql/{$matches[1]}/en/" ); + if ( 200 != wp_remote_retrieve_response_code( $response ) ) { + $this->markTestSkipped( 'Could not contact dev.MySQL.com to check versions.' ); + } + $mysql = wp_remote_retrieve_body( $response ); + + preg_match( '#(\d{4}-\d{2}-\d{2}), General Availability#', $mysql, $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' ); + + $this->assertLessThan( $mysql_eol, time(), "readme.html's Recommended MySQL version is too old. Remember to update the WordPress.org Requirements page, too." ); } function test_license() {