Changeset 50100 for branches/4.4/tests/phpunit/includes/testcase.php
- Timestamp:
- 01/30/2021 03:26:59 PM (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/4.4/tests/phpunit/includes/testcase.php
r50091 r50100 171 171 172 172 /** 173 * Allow tests to be skipped if the HTTP request times out. 174 * 175 * @param array|WP_Error $response HTTP response. 176 */ 177 public function skipTestOnTimeout( $response ) { 178 if ( ! is_wp_error( $response ) ) { 179 return; 180 } 181 if ( 'connect() timed out!' === $response->get_error_message() ) { 182 $this->markTestSkipped( 'HTTP timeout' ); 183 } 184 185 if ( false !== strpos( $response->get_error_message(), 'timed out after' ) ) { 186 $this->markTestSkipped( 'HTTP timeout' ); 187 } 188 189 if ( 0 === strpos( $response->get_error_message(), 'stream_socket_client(): unable to connect to tcp://s.w.org:80' ) ) { 190 $this->markTestSkipped( 'HTTP timeout' ); 191 } 192 193 } 194 195 /** 173 196 * Unregister existing post types and register defaults. 174 197 * … … 205 228 _unregister_post_status( $post_status ); 206 229 } 207 }208 209 /**210 * Allow tests to be skipped if the HTTP request times out.211 *212 * @param array|WP_Error $response HTTP response.213 */214 public function skipTestOnTimeout( $response ) {215 if ( ! is_wp_error( $response ) ) {216 return;217 }218 if ( 'connect() timed out!' === $response->get_error_message() ) {219 $this->markTestSkipped( 'HTTP timeout' );220 }221 222 if ( false !== strpos( $response->get_error_message(), 'timed out after' ) ) {223 $this->markTestSkipped( 'HTTP timeout' );224 }225 226 if ( 0 === strpos( $response->get_error_message(), 'stream_socket_client(): unable to connect to tcp://s.w.org:80' ) ) {227 $this->markTestSkipped( 'HTTP timeout' );228 }229 230 230 } 231 231
Note: See TracChangeset
for help on using the changeset viewer.