Make WordPress Core


Ignore:
Timestamp:
12/15/2021 07:59:32 PM (2 years ago)
Author:
SergeyBiryukov
Message:

Tests: Mock the HTTP request response in download_url() tests.

This aims to speed up the tests and minimize unrelated failures by avoiding an unnecessary external HTTP request, while still performing the intended functionality checks.

Update similar helpers in some other tests to use more consistent terminology.

Follow-up to [37907], [46175], [51626].

See #54420, #53363.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/tests/http/wpGetHttpHeaders.php

    r51568 r52382  
    1313        parent::set_up();
    1414
    15         // Hook a fake HTTP request response.
    16         add_filter( 'pre_http_request', array( $this, 'fake_http_request' ), 10, 3 );
     15        // Hook a mocked HTTP request response.
     16        add_filter( 'pre_http_request', array( $this, 'mock_http_request' ), 10, 3 );
    1717    }
    1818
     
    4848     * @param array  $arguments Request arguments.
    4949     * @param string $url       Request URL.
    50      *
    5150     * @return array|bool
    5251     */
    53     public function fake_http_request( $false, $arguments, $url ) {
     52    public function mock_http_request( $false, $arguments, $url ) {
    5453        if ( 'http://example.com' === $url ) {
    5554            return array( 'headers' => true );
Note: See TracChangeset for help on using the changeset viewer.