Changeset 50097 for branches/4.7/tests/phpunit/includes/testcase.php
- Timestamp:
- 01/30/2021 03:21:27 PM (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/4.7/tests/phpunit/includes/testcase.php
r50088 r50097 199 199 200 200 /** 201 * Allow tests to be skipped if the HTTP request times out. 202 * 203 * @param array|WP_Error $response HTTP response. 204 */ 205 public function skipTestOnTimeout( $response ) { 206 if ( ! is_wp_error( $response ) ) { 207 return; 208 } 209 if ( 'connect() timed out!' === $response->get_error_message() ) { 210 $this->markTestSkipped( 'HTTP timeout' ); 211 } 212 213 if ( false !== strpos( $response->get_error_message(), 'timed out after' ) ) { 214 $this->markTestSkipped( 'HTTP timeout' ); 215 } 216 217 if ( 0 === strpos( $response->get_error_message(), 'stream_socket_client(): unable to connect to tcp://s.w.org:80' ) ) { 218 $this->markTestSkipped( 'HTTP timeout' ); 219 } 220 221 } 222 223 /** 201 224 * Unregister existing post types and register defaults. 202 225 * … … 233 256 _unregister_post_status( $post_status ); 234 257 } 235 }236 237 /**238 * Allow tests to be skipped if the HTTP request times out.239 *240 * @param array|WP_Error $response HTTP response.241 */242 public function skipTestOnTimeout( $response ) {243 if ( ! is_wp_error( $response ) ) {244 return;245 }246 if ( 'connect() timed out!' === $response->get_error_message() ) {247 $this->markTestSkipped( 'HTTP timeout' );248 }249 250 if ( false !== strpos( $response->get_error_message(), 'timed out after' ) ) {251 $this->markTestSkipped( 'HTTP timeout' );252 }253 254 if ( 0 === strpos( $response->get_error_message(), 'stream_socket_client(): unable to connect to tcp://s.w.org:80' ) ) {255 $this->markTestSkipped( 'HTTP timeout' );256 }257 258 258 } 259 259
Note: See TracChangeset
for help on using the changeset viewer.