Make WordPress Core


Ignore:
Timestamp:
12/15/2022 04:46:42 AM (4 years 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 4.6 branch.
Fixes #57306.
See #56793.

Location:
branches/4.6
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/4.6

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

    r50089 r54989  
    357357
    358358        /**
    359          * Test HTTP Redirects with multiple Location headers specified
    360          *
    361          * @ticket 16890
    362          */
    363         function test_multiple_location_headers() {
    364                 $url = 'http://api.wordpress.org/core/tests/1.0/redirection.php?multiple-location-headers=1';
    365                 $res = wp_remote_head( $url, array( 'timeout' => 30 ) );
    366 
    367                 $this->skipTestOnTimeout( $res );
    368                 $this->assertInternalType( 'array', wp_remote_retrieve_header( $res, 'location' ) );
    369                 $this->assertCount( 2, wp_remote_retrieve_header( $res, 'location' ) );
    370 
    371                 $res = wp_remote_get( $url, array( 'timeout' => 30 ) );
    372 
    373                 $this->skipTestOnTimeout( $res );
    374                 $this->assertEquals( 'PASS', wp_remote_retrieve_body( $res ) );
    375 
    376         }
    377 
    378         /**
    379359         * Test HTTP Cookie handling
    380360         *
Note: See TracChangeset for help on using the changeset viewer.