Make WordPress Core

Changeset 65733


Ignore:
Timestamp:
11/20/2026 11:02:41 PM (7 hours ago)
Author:
SergeyBiryukov
Message:

Tests: Cover esc_url_raw().

Verify that ampersands are not entity-encoded in database context and custom protocols are accepted.

Developed in ​https://github.com/WordPress/wordpress-develop/pull/15360.

Props devmuhib, huzaifaalmesbah, lancewillett.
See #65819.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/tests/formatting/escUrl.php

    r60734 r65733  
    55 *
    66 * @covers ::esc_url
     7 * @covers ::esc_url_raw
    78 */
    89class Tests_Formatting_EscUrl extends WP_UnitTestCase {
    … …  
    312313                $this->assertSame( 'http://[::FFFF::127.0.0.1]/?foo%5Bbar%5D=baz', esc_url( 'http://[::FFFF::127.0.0.1]/?foo[bar]=baz' ) );
    313314        }
     315
     316        /**
     317         * Tests that esc_url_raw() preserves raw ampersands and accepts custom protocols.
     318         *
     319         * @ticket 65819
     320         */
     321        public function test_esc_url_raw() {
     322                $url = 'custom://example.com/?one=1&two=2';
     323
     324                $this->assertSame( $url, esc_url_raw( $url, array( 'custom' ) ) );
     325        }
    314326}
Note: See TracChangeset for help on using the changeset viewer.