Make WordPress Core

Changeset 53574


Ignore:
Timestamp:
06/24/2022 03:07:40 PM (4 years ago)
Author:
SergeyBiryukov
Message:

Tests: Replace esc_url_raw() calls with sanitize_url().

Previously committed in [53455], appears to be accidentally reverted in [53562].

Follow-up to [51597], [53452], [53455], [53562].

See #39265, #55652.

File:
1 edited

Legend:

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

    r53562 r53574  
    5151        /**
    5252         * @covers ::esc_url
    53          * @covers ::esc_url_raw
     53         * @covers ::sanitize_url
    5454         */
    5555        public function test_all_url_parts() {
     
    6969                        parse_url( $url )
    7070                );
    71                 $this->assertSame( 'https://user:pass@host.example.com:1234/path;p=1?query=2&r%5B%5D=3#fragment', esc_url_raw( $url ) );
     71                $this->assertSame( 'https://user:pass@host.example.com:1234/path;p=1?query=2&r%5B%5D=3#fragment', sanitize_url( $url ) );
    7272                $this->assertSame( 'https://user:pass@host.example.com:1234/path;p=1?query=2&r%5B%5D=3#fragment', esc_url( $url ) );
    7373        }
     
    8686        /**
    8787         * @covers ::esc_url
    88          * @covers ::esc_url_raw
     88         * @covers ::sanitize_url
    8989         */
    9090        public function test_encoding() {
    91                 $this->assertSame( 'http://example.com?foo=1&bar=2', esc_url_raw( 'http://example.com?foo=1&bar=2' ) );
    92                 $this->assertSame( 'http://example.com?foo=1&bar=2', esc_url_raw( 'http://example.com?foo=1&bar=2' ) );
    93                 $this->assertSame( 'http://example.com?foo=1&bar=2', esc_url_raw( 'http://example.com?foo=1&bar=2' ) );
     91                $this->assertSame( 'http://example.com?foo=1&bar=2', sanitize_url( 'http://example.com?foo=1&bar=2' ) );
     92                $this->assertSame( 'http://example.com?foo=1&bar=2', sanitize_url( 'http://example.com?foo=1&bar=2' ) );
     93                $this->assertSame( 'http://example.com?foo=1&bar=2', sanitize_url( 'http://example.com?foo=1&bar=2' ) );
    9494
    9595                $this->assertSame( 'http://example.com?foo=1&bar=2', esc_url( 'http://example.com?foo=1&bar=2' ) );
     
    225225         * Courtesy of http://blog.lunatech.com/2009/02/03/what-every-web-developer-must-know-about-url-encoding
    226226         *
    227          * @covers ::esc_url_raw
     227         * @covers ::sanitize_url
    228228         */
    229229        public function test_reserved_characters() {
    230230                $url = "http://example.com/:@-._~!$&'()*+,=;:@-._~!$&'()*+,=:@-._~!$&'()*+,==?/?:@-._~!$%27()*+,;=/?:@-._~!$%27()*+,;==#/?:@-._~!$&'()*+,;=";
    231                 $this->assertSame( $url, esc_url_raw( $url ) );
     231                $this->assertSame( $url, sanitize_url( $url ) );
    232232        }
    233233
     
    291291         * @ticket 28015
    292292         *
    293          * @covers ::esc_url_raw
     293         * @covers ::sanitize_url
    294294         */
    295295        public function test_invalid_charaters() {
    296                 $this->assertEmpty( esc_url_raw( '"^<>{}`' ) );
     296                $this->assertEmpty( sanitize_url( '"^<>{}`' ) );
    297297        }
    298298
Note: See TracChangeset for help on using the changeset viewer.