mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-07-09 11:40:04 +00:00
Formatting: wp_make_link_relative() should return an empty string if no path is present in the link.
Props bcworkz, MikeHansenMe, chriscct7, SergeyBiryukov. Fixes #26819. git-svn-id: https://develop.svn.wordpress.org/trunk@35497 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -304,36 +304,6 @@ class Tests_Link extends WP_UnitTestCase {
|
||||
$this->assertEquals( $p3, $found->ID );
|
||||
}
|
||||
|
||||
public function test_wp_make_link_relative_with_http_scheme() {
|
||||
$link = 'http://example.com/this-is-a-test-http-url/';
|
||||
$relative_link = wp_make_link_relative( $link );
|
||||
$this->assertEquals( '/this-is-a-test-http-url/', $relative_link );
|
||||
}
|
||||
|
||||
public function test_wp_make_link_relative_with_https_scheme() {
|
||||
$link = 'https://example.com/this-is-a-test-https-url/';
|
||||
$relative_link = wp_make_link_relative( $link );
|
||||
$this->assertEquals( '/this-is-a-test-https-url/', $relative_link );
|
||||
}
|
||||
|
||||
/**
|
||||
* @ticket 30373
|
||||
*/
|
||||
public function test_wp_make_link_relative_with_no_scheme() {
|
||||
$link = '//example.com/this-is-a-test-schemeless-url/';
|
||||
$relative_link = wp_make_link_relative( $link );
|
||||
$this->assertEquals( '/this-is-a-test-schemeless-url/', $relative_link );
|
||||
}
|
||||
|
||||
/**
|
||||
* @ticket 30373
|
||||
*/
|
||||
public function test_wp_make_link_relative_should_retain_URL_param_that_is_also_a_URL() {
|
||||
$link = 'https://example.com/this-is-a-test/?redirect=https://example.org/a-different-test-post/';
|
||||
$relative_link = wp_make_link_relative( $link );
|
||||
$this->assertEquals( '/this-is-a-test/?redirect=https://example.org/a-different-test-post/', $relative_link );
|
||||
}
|
||||
|
||||
/**
|
||||
* @ticket 30910
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user