259 | | } |
260 | | No newline at end of file |
| 259 | |
| 260 | public function test_wp_make_link_relative_with_http_scheme() { |
| 261 | $link = 'http://example.com/this-is-a-test-http-url/'; |
| 262 | $relative_link = wp_make_link_relative( $link ); |
| 263 | $this->assertEquals( '/this-is-a-test-http-url/', $relative_link ); |
| 264 | } |
| 265 | |
| 266 | public function test_wp_make_link_relative_with_https_scheme() { |
| 267 | $link = 'https://example.com/this-is-a-test-https-url/'; |
| 268 | $relative_link = wp_make_link_relative( $link ); |
| 269 | $this->assertEquals( '/this-is-a-test-https-url/', $relative_link ); |
| 270 | } |
| 271 | |
| 272 | // @group 30373 |
| 273 | public function test_wp_make_link_relative_with_no_scheme() { |
| 274 | $link = '//example.com/this-is-a-test-schemeless-url/'; |
| 275 | $relative_link = wp_make_link_relative( $link ); |
| 276 | $this->assertEquals( '/this-is-a-test-schemeless-url/', $relative_link ); |
| 277 | } |
| 278 | |
| 279 | public function test_wp_make_link_relative_only_first_scheme() { |
| 280 | $link = 'https://example.com/this-is-a-test/?redirect=https://example.org/a-different-test-post/'; |
| 281 | $relative_link = wp_make_link_relative( $link ); |
| 282 | $this->assertEquals( '/this-is-a-test/?redirect=https://example.org/a-different-test-post/', $relative_link ); |
| 283 | } |
| 284 | } |