mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-06-28 22:30:04 +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:
@@ -180,7 +180,7 @@ abstract class WP_UnitTestCase_Base extends PHPUnit_Framework_TestCase {
|
||||
}
|
||||
|
||||
/**
|
||||
* Allow tests to be skipped on some automated runs
|
||||
* Allow tests to be skipped on some automated runs.
|
||||
*
|
||||
* For test runs on Travis for something other than trunk/master
|
||||
* we want to skip tests that only need to run for master.
|
||||
@@ -222,6 +222,29 @@ abstract class WP_UnitTestCase_Base 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.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user