Tests: In test_readme(), if the HTTP request to secure.php.net or dev.mysql.com failed, include response code in the error message.

See #40533, #44613.

git-svn-id: https://develop.svn.wordpress.org/trunk@46996 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Sergey Biryukov 2019-12-19 15:43:33 +00:00
parent 7cdb642610
commit 9fe4689f2d

View File

@ -16,8 +16,9 @@ class Tests_External_HTTP_Basic extends WP_UnitTestCase {
$this->skipTestOnTimeout( $response );
if ( 200 !== wp_remote_retrieve_response_code( $response ) ) {
$this->fail( 'Could not contact PHP.net to check versions.' );
$response_code = wp_remote_retrieve_response_code( $response );
if ( 200 !== $response_code ) {
$this->fail( sprintf( 'Could not contact PHP.net to check versions. Response code: %s', $response_code ) );
}
$php = wp_remote_retrieve_body( $response );
@ -32,8 +33,9 @@ class Tests_External_HTTP_Basic extends WP_UnitTestCase {
$this->skipTestOnTimeout( $response );
if ( 200 !== wp_remote_retrieve_response_code( $response ) ) {
$this->fail( 'Could not contact dev.MySQL.com to check versions.' );
$response_code = wp_remote_retrieve_response_code( $response );
if ( 200 !== $response_code ) {
$this->fail( sprintf( 'Could not contact dev.MySQL.com to check versions. Response code: %s', $response_code ) );
}
$mysql = wp_remote_retrieve_body( $response );