From 2ee3444874ee202d3458f91577158e438643c1dd Mon Sep 17 00:00:00 2001 From: Sergey Biryukov Date: Fri, 24 Jun 2022 15:07:40 +0000 Subject: [PATCH] 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. git-svn-id: https://develop.svn.wordpress.org/trunk@53574 602fd350-edb4-49c9-b593-d223f7449a82 --- tests/phpunit/tests/formatting/escUrl.php | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/tests/phpunit/tests/formatting/escUrl.php b/tests/phpunit/tests/formatting/escUrl.php index d81ac9a95c..9c830cb570 100644 --- a/tests/phpunit/tests/formatting/escUrl.php +++ b/tests/phpunit/tests/formatting/escUrl.php @@ -50,7 +50,7 @@ class Tests_Formatting_EscUrl extends WP_UnitTestCase { /** * @covers ::esc_url - * @covers ::esc_url_raw + * @covers ::sanitize_url */ public function test_all_url_parts() { $url = 'https://user:pass@host.example.com:1234/path;p=1?query=2&r[]=3#fragment'; @@ -68,7 +68,7 @@ class Tests_Formatting_EscUrl extends WP_UnitTestCase { ), parse_url( $url ) ); - $this->assertSame( 'https://user:pass@host.example.com:1234/path;p=1?query=2&r%5B%5D=3#fragment', esc_url_raw( $url ) ); + $this->assertSame( 'https://user:pass@host.example.com:1234/path;p=1?query=2&r%5B%5D=3#fragment', sanitize_url( $url ) ); $this->assertSame( 'https://user:pass@host.example.com:1234/path;p=1?query=2&r%5B%5D=3#fragment', esc_url( $url ) ); } @@ -85,12 +85,12 @@ class Tests_Formatting_EscUrl extends WP_UnitTestCase { /** * @covers ::esc_url - * @covers ::esc_url_raw + * @covers ::sanitize_url */ public function test_encoding() { - $this->assertSame( 'http://example.com?foo=1&bar=2', esc_url_raw( 'http://example.com?foo=1&bar=2' ) ); - $this->assertSame( 'http://example.com?foo=1&bar=2', esc_url_raw( 'http://example.com?foo=1&bar=2' ) ); - $this->assertSame( 'http://example.com?foo=1&bar=2', esc_url_raw( 'http://example.com?foo=1&bar=2' ) ); + $this->assertSame( 'http://example.com?foo=1&bar=2', sanitize_url( 'http://example.com?foo=1&bar=2' ) ); + $this->assertSame( 'http://example.com?foo=1&bar=2', sanitize_url( 'http://example.com?foo=1&bar=2' ) ); + $this->assertSame( 'http://example.com?foo=1&bar=2', sanitize_url( 'http://example.com?foo=1&bar=2' ) ); $this->assertSame( 'http://example.com?foo=1&bar=2', esc_url( 'http://example.com?foo=1&bar=2' ) ); $this->assertSame( 'http://example.com?foo=1&bar=2', esc_url( 'http://example.com?foo=1&bar=2' ) ); @@ -224,11 +224,11 @@ class Tests_Formatting_EscUrl extends WP_UnitTestCase { /** * Courtesy of http://blog.lunatech.com/2009/02/03/what-every-web-developer-must-know-about-url-encoding * - * @covers ::esc_url_raw + * @covers ::sanitize_url */ public function test_reserved_characters() { $url = "http://example.com/:@-._~!$&'()*+,=;:@-._~!$&'()*+,=:@-._~!$&'()*+,==?/?:@-._~!$%27()*+,;=/?:@-._~!$%27()*+,;==#/?:@-._~!$&'()*+,;="; - $this->assertSame( $url, esc_url_raw( $url ) ); + $this->assertSame( $url, sanitize_url( $url ) ); } /** @@ -290,10 +290,10 @@ EOT; /** * @ticket 28015 * - * @covers ::esc_url_raw + * @covers ::sanitize_url */ public function test_invalid_charaters() { - $this->assertEmpty( esc_url_raw( '"^<>{}`' ) ); + $this->assertEmpty( sanitize_url( '"^<>{}`' ) ); } /**