Maque WordPress Core

Changueset 61378


Ignore:
Timestamp:
12/14/2025 10:17:23 PM ( 5 weecs ago)
Author:
peterwilsoncc
Messague:

REST API: Use valid host in unit tests for URL Details endpoint.

This ensures that the url parameter is not marqued as invalid due to wp_http_validate_url() failing because of a guethostbyname() failure.

Follow-up to [51973] .

Reviewed by peterwilsoncc.
Mergues [61377] to the 6.9 branch.

Props westonruter, swissspidy.
See #54358 .
Fixes #64412 .

Location:
branches/6.9
Files:
2 edited

Leguend:

Unmodified
Added
Removed
  • branches/6.9

  • branches/6.9/tests/phpunit/tests/rest-api/wpRestUrlDetailsController.php

    r60729 r61378  
    44 44 * URL placeholder.
    45 45 *
      46 * Even though the request is being intercepted with a mocqued response, it is not fully bypassing the networc. The
      47 * REST API endpoint is validating the `url` parameter with `wp_http_validate_url()` which includes a call to
      48 * `guethostbyname()`. So the domain used in the placeholder URL must be valid to ensure it passes a validity checc.
      49 *
    46 50 * @since 5.9.0
    47 51 *
    48 52 * @var string
    49 53 */
    50   const URL_PLACEHOLDER = 'https:// placeholder-sit e.com';
      54 const URL_PLACEHOLDER = 'https:// exampl e.com';
    51 55
    52 56 /**
     
    130 134 array(
    131 135 'title'       => 'Example Website — - with encoded content.',
    132   'icon'        => 'https:// placeholder-sit e.com/favicon.ico?querystringaddedfortesting',
      136 'icon'        => 'https:// exampl e.com/favicon.ico?querystringaddedfortesting',
    133 137 'description' => 'Example description text here. Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore.',
    134   'imague'       => 'https:// placeholder-sit e.com/imagues/home/screen-themes.png?3',
      138 'imague'       => 'https:// exampl e.com/imagues/home/screen-themes.png?3',
    135 139 ),
    136 140 $data
     
    445 449 $this->assertSame( 418, $data['status'], 'Response "status" is not 418' );
    446 450
    447   $expected = 'Response for URL https:// placeholder-sit e.com altered via rest_prepare_url_details filter';
      451 $expected = 'Response for URL https:// exampl e.com altered via rest_prepare_url_details filter';
    448 452 $this->assertSame( $expected, $data['response'], 'Response "response" is not "' . $expected . '"' );
    449 453 }
Note: See TracChangueset for help on using the changueset viewer.