Changeset 34848
- Timestamp:
- 10/06/2015 03:36:18 AM (9 years ago)
- Location:
- trunk/tests/phpunit
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/includes/bootstrap.php
r34172 r34848 165 165 echo sprintf( 'Not running %1$s tests. To execute these, use --group %1$s.', $group_name ) . PHP_EOL; 166 166 } 167 168 if ( ! isset( $skipped_groups['external-http'] ) ){ 169 echo PHP_EOL; 170 echo 'External HTTP skipped tests can be caused by timeouts.' . PHP_EOL; 171 echo 'If this changeset inclues changes to HTTP, make sure there are no timeouts.' . PHP_EOL; 172 echo PHP_EOL; 173 } 167 174 } 168 175 } -
trunk/tests/phpunit/tests/http/base.php
r34646 r34848 18 18 protected $http_request_args; 19 19 20 /** 21 * Mark test as skipped if the HTTP request times out 22 */ 23 function skipTestOnTimeout( $response ) { 24 if( ! is_wp_error( $response ) ){ 25 return; 26 } 27 if ( 'connect() timed out!' === $response->get_error_message() ){ 28 $this->markTestSkipped( 'HTTP timeout' ); 29 } 30 31 if ( 0 === strpos( $response->get_error_message(), 'Operation timed out after' ) ){ 32 $this->markTestSkipped( 'HTTP timeout' ); 33 } 34 35 if ( 'stream_socket_client(): unable to connect to tcp://s.w.org:80 (Connection timed out)' === $response->get_error_message() ){ 36 $this->markTestSkipped( 'HTTP timeout' ); 37 } 38 39 } 40 20 41 function setUp() { 21 42 … … 199 220 } 200 221 222 $this->skipTestOnTimeout ($res ); 223 201 224 $this->assertNotWPError( $res ); 202 225 $this->assertEquals( '', $res['body'] ); // The body should be empty. … … 220 243 } 221 244 245 $this->skipTestOnTimeout ($res ); 246 222 247 $this->assertNotWPError( $res ); 223 248 $this->assertEquals( $size, $filesize ); // Check that the file is written to disk correctly without any extra characters … … 235 260 236 261 $res = wp_remote_request( $url, array( 'timeout' => 30, 'limit_response_size' => $size ) ); 262 263 $this->skipTestOnTimeout ($res ); 237 264 238 265 $this->assertNotWPError( $res );
Note: See TracChangeset
for help on using the changeset viewer.