mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2025-10-16 12:05:38 +00:00
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
This commit is contained in:
parent
78c315dc00
commit
2ee3444874
@ -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( '"^<>{}`' ) );
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Loading…
Reference in New Issue
Block a user