Make WordPress Core


Ignore:
Timestamp:
01/30/2021 11:13:04 AM (4 years ago)
Author:
SergeyBiryukov
Message:

Tests: Use skipTestOnTimeout() in more HTTP tests.

Adjust it to handle more types of timeouts, e.g. "Resolving timed out", "Connection timed out".

Merges [43511], [43512], [46682], [46996] to the 4.8 branch.
See #51669.

Location:
branches/4.8
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/4.8

  • branches/4.8/tests/phpunit/tests/external-http/basic.php

    r40519 r50087  
    1414
    1515        $response = wp_remote_get( 'https://secure.php.net/supported-versions.php' );
    16         if ( 200 != wp_remote_retrieve_response_code( $response ) ) {
    17             $this->fail( 'Could not contact PHP.net to check versions.' );
     16
     17        $this->skipTestOnTimeout( $response );
     18
     19        $response_code = wp_remote_retrieve_response_code( $response );
     20        if ( 200 !== $response_code ) {
     21            $this->fail( sprintf( 'Could not contact PHP.net to check versions. Response code: %s', $response_code ) );
    1822        }
     23
    1924        $php = wp_remote_retrieve_body( $response );
    2025
     
    2631
    2732        $response = wp_remote_get( "https://dev.mysql.com/doc/relnotes/mysql/{$matches[1]}/en/" );
    28         if ( 200 != wp_remote_retrieve_response_code( $response ) ) {
    29             $this->fail( 'Could not contact dev.MySQL.com to check versions.' );
     33
     34        $this->skipTestOnTimeout( $response );
     35
     36        $response_code = wp_remote_retrieve_response_code( $response );
     37        if ( 200 !== $response_code ) {
     38            $this->fail( sprintf( 'Could not contact dev.MySQL.com to check versions. Response code: %s', $response_code ) );
    3039        }
     40
    3141        $mysql = wp_remote_retrieve_body( $response );
    3242
Note: See TracChangeset for help on using the changeset viewer.