mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-08-11 20:30:23 +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:
@@ -6,27 +6,6 @@
|
||||
*/
|
||||
class Tests_HTTP_Functions extends WP_UnitTestCase {
|
||||
|
||||
/**
|
||||
* Mark test as skipped if the HTTP request times out.
|
||||
*/
|
||||
function skipTestOnTimeout( $response ) {
|
||||
if ( ! is_wp_error( $response ) ) {
|
||||
return;
|
||||
}
|
||||
if ( 'connect() timed out!' === $response->get_error_message() ) {
|
||||
$this->markTestSkipped( 'HTTP timeout' );
|
||||
}
|
||||
|
||||
if ( false !== strpos( $response->get_error_message(), 'timed out after' ) ) {
|
||||
$this->markTestSkipped( 'HTTP timeout' );
|
||||
}
|
||||
|
||||
if ( 0 === strpos( $response->get_error_message(), 'stream_socket_client(): unable to connect to tcp://s.w.org:80' ) ) {
|
||||
$this->markTestSkipped( 'HTTP timeout' );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public function setUp() {
|
||||
if ( ! extension_loaded( 'openssl' ) ) {
|
||||
$this->markTestSkipped( 'Tests_HTTP_Functions requires openssl.' );
|
||||
|
||||
Reference in New Issue
Block a user