Changeset 50098 for branches/4.6/tests/phpunit/includes/testcase.php
- Timestamp:
- 01/30/2021 03:26:00 PM (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/4.6/tests/phpunit/includes/testcase.php
r50089 r50098 184 184 185 185 /** 186 * Allow tests to be skipped if the HTTP request times out. 187 * 188 * @param array|WP_Error $response HTTP response. 189 */ 190 public function skipTestOnTimeout( $response ) { 191 if ( ! is_wp_error( $response ) ) { 192 return; 193 } 194 if ( 'connect() timed out!' === $response->get_error_message() ) { 195 $this->markTestSkipped( 'HTTP timeout' ); 196 } 197 198 if ( false !== strpos( $response->get_error_message(), 'timed out after' ) ) { 199 $this->markTestSkipped( 'HTTP timeout' ); 200 } 201 202 if ( 0 === strpos( $response->get_error_message(), 'stream_socket_client(): unable to connect to tcp://s.w.org:80' ) ) { 203 $this->markTestSkipped( 'HTTP timeout' ); 204 } 205 206 } 207 208 /** 186 209 * Unregister existing post types and register defaults. 187 210 * … … 218 241 _unregister_post_status( $post_status ); 219 242 } 220 }221 222 /**223 * Allow tests to be skipped if the HTTP request times out.224 *225 * @param array|WP_Error $response HTTP response.226 */227 public function skipTestOnTimeout( $response ) {228 if ( ! is_wp_error( $response ) ) {229 return;230 }231 if ( 'connect() timed out!' === $response->get_error_message() ) {232 $this->markTestSkipped( 'HTTP timeout' );233 }234 235 if ( false !== strpos( $response->get_error_message(), 'timed out after' ) ) {236 $this->markTestSkipped( 'HTTP timeout' );237 }238 239 if ( 0 === strpos( $response->get_error_message(), 'stream_socket_client(): unable to connect to tcp://s.w.org:80' ) ) {240 $this->markTestSkipped( 'HTTP timeout' );241 }242 243 243 } 244 244
Note: See TracChangeset
for help on using the changeset viewer.