From 9fe4689f2d00fdc91411749a615dd59fde68318a Mon Sep 17 00:00:00 2001 From: Sergey Biryukov Date: Thu, 19 Dec 2019 15:43:33 +0000 Subject: [PATCH] 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 --- tests/phpunit/tests/external-http/basic.php | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/tests/phpunit/tests/external-http/basic.php b/tests/phpunit/tests/external-http/basic.php index 427a991161..0da6b33511 100644 --- a/tests/phpunit/tests/external-http/basic.php +++ b/tests/phpunit/tests/external-http/basic.php @@ -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 );