mirror of
git://develop.git.wordpress.org/
synced 2025-01-17 04:48:25 +01:00
Tests: Move skipTestOnTimeout()
to a more appropriate location, for consistency with other branches.
Follow-up to [50088]. Merges [50097] to the 4.6 branch. See #51669. git-svn-id: https://develop.svn.wordpress.org/branches/4.6@50098 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
70452d0e4a
commit
92ee7e12d6
@ -182,6 +182,29 @@ class WP_UnitTestCase extends PHPUnit_Framework_TestCase {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Allow tests to be skipped if the HTTP request times out.
|
||||
*
|
||||
* @param array|WP_Error $response HTTP response.
|
||||
*/
|
||||
public 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' );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Unregister existing post types and register defaults.
|
||||
*
|
||||
@ -219,29 +242,6 @@ class WP_UnitTestCase extends PHPUnit_Framework_TestCase {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Allow tests to be skipped if the HTTP request times out.
|
||||
*
|
||||
* @param array|WP_Error $response HTTP response.
|
||||
*/
|
||||
public 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' );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Reset `$_SERVER` variables
|
||||
*/
|
||||
|
Loading…
x
Reference in New Issue
Block a user