Make WordPress Core


Ignore:
Timestamp:
12/15/2021 07:59:32 PM (3 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/functions/doEnclose.php

    r51627 r52382  
    2626    public function set_up() {
    2727        parent::set_up();
    28         add_filter( 'pre_http_request', array( $this, 'fake_http_request' ), 10, 3 );
     28        add_filter( 'pre_http_request', array( $this, 'mock_http_request' ), 10, 3 );
    2929    }
    3030
     
    251251
    252252    /**
    253      * Fake the HTTP request response.
     253     * Mock the HTTP request response.
    254254     *
    255255     * @since 5.3.0
     
    258258     * @param array  $arguments Request arguments.
    259259     * @param string $url       Request URL.
    260      *
    261260     * @return array            Header.
    262261     */
    263     public function fake_http_request( $false, $arguments, $url ) {
     262    public function mock_http_request( $false, $arguments, $url ) {
    264263
    265264        // Video and audio headers.
Note: See TracChangeset for help on using the changeset viewer.