Make WordPress Core


Ignore:
Timestamp:
12/15/2022 04:35:10 AM (21 months ago)
Author:
peterwilsoncc
Message:

Built/Test tools, HTTP API: Refactor test for multiple location headers.

Remove wordpress.org as an external dependency testing WP_HTTP::handle_redirects().

This refactors and reenables an existing test to call the WP_HTTP::handle_redirects() method directly with a mocked array of HTTP headers containing multiple location headers.

The test is moved from the external-http group to the http test group as it no longer makes an HTTP request.

Follow up to [54955].

Props SergeyBiryukov, dd32, peterwilsoncc.
Merges [54968] to the 5.1 branch.
Fixes #57306.
See #56793.

Location:
branches/5.1
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/5.1

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

    r50094 r54984  
    395395
    396396    /**
    397      * Test HTTP Redirects with multiple Location headers specified
    398      *
    399      * @ticket 16890
    400      */
    401     function test_multiple_location_headers() {
    402         $url = 'http://api.wordpress.org/core/tests/1.0/redirection.php?multiple-location-headers=1';
    403         $res = wp_remote_head( $url, array( 'timeout' => 30 ) );
    404 
    405         $this->skipTestOnTimeout( $res );
    406         $this->assertInternalType( 'array', wp_remote_retrieve_header( $res, 'location' ) );
    407         $this->assertCount( 2, wp_remote_retrieve_header( $res, 'location' ) );
    408 
    409         $res = wp_remote_get( $url, array( 'timeout' => 30 ) );
    410 
    411         $this->skipTestOnTimeout( $res );
    412         $this->assertEquals( 'PASS', wp_remote_retrieve_body( $res ) );
    413 
    414     }
    415 
    416     /**
    417397     * Test HTTP Cookie handling
    418398     *
Note: See TracChangeset for help on using the changeset viewer.