Make WordPress Core


Ignore:
Timestamp:
01/30/2021 01:05:57 PM (6 years ago)
Author:
SergeyBiryukov
Message:

Tests: Skip test_readme() if the HTTP request to secure.php.net or dev.mysql.com failed on timeout.

Move skipTestOnTimeout() to WP_UnitTestCase_Base to avoid duplication.

Merges [46682] and [46996] to the 5.1 branch.
See #51669.

Location:
branches/5.1
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/5.1

  • branches/5.1/tests/phpunit/tests/http/base.php

    r44577 r50094  
    1818        protected $http_request_args;
    1919
    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 ( false !== strpos( $response->get_error_message(), 'timed out after' ) ) {
    32                         $this->markTestSkipped( 'HTTP timeout' );
    33                 }
    34 
    35                 if ( 0 === strpos( $response->get_error_message(), 'stream_socket_client(): unable to connect to tcp://s.w.org:80' ) ) {
    36                         $this->markTestSkipped( 'HTTP timeout' );
    37                 }
    38 
    39         }
    40 
    4120        function setUp() {
    4221                parent::setUp();
Note: See TracChangeset for help on using the changeset viewer.