mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-10-06 15:47:05 +00:00
Tests: Skip test_readme() if the HTTP request to secure.php.net or dev.mysql.com failed on timeout.
Move `skipTestOnTimeout()` to `WP_UnitTestCase_Base` to avoid duplication. See #44613. git-svn-id: https://develop.svn.wordpress.org/trunk@46682 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -13,9 +13,13 @@ class Tests_External_HTTP_Basic extends WP_UnitTestCase {
|
||||
preg_match( '#Recommendations.*PHP</a> version <strong>([0-9.]*)#s', $readme, $matches );
|
||||
|
||||
$response = wp_remote_get( 'https://secure.php.net/supported-versions.php' );
|
||||
|
||||
$this->skipTestOnTimeout( $response );
|
||||
|
||||
if ( 200 !== wp_remote_retrieve_response_code( $response ) ) {
|
||||
$this->fail( 'Could not contact PHP.net to check versions.' );
|
||||
}
|
||||
|
||||
$php = wp_remote_retrieve_body( $response );
|
||||
|
||||
preg_match_all( '#<tr class="stable">\s*<td>\s*<a [^>]*>\s*([0-9.]*)#s', $php, $phpmatches );
|
||||
@@ -25,9 +29,13 @@ class Tests_External_HTTP_Basic extends WP_UnitTestCase {
|
||||
preg_match( '#Recommendations.*MySQL</a> version <strong>([0-9.]*)#s', $readme, $matches );
|
||||
|
||||
$response = wp_remote_get( "https://dev.mysql.com/doc/relnotes/mysql/{$matches[1]}/en/" );
|
||||
|
||||
$this->skipTestOnTimeout( $response );
|
||||
|
||||
if ( 200 !== wp_remote_retrieve_response_code( $response ) ) {
|
||||
$this->fail( '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 );
|
||||
|
||||
Reference in New Issue
Block a user