| | 309 | |
| | 310 | /** |
| | 311 | * Test that *_url functions handle ".." and "..." requests properly. |
| | 312 | * @ticket 19032 |
| | 313 | */ |
| | 314 | public function test_get_home_url() { |
| | 315 | $test_cases = array( |
| | 316 | |
| | 317 | /** Functions that DO NOT return a trailing slash **/ |
| | 318 | |
| | 319 | // get_admin_url |
| | 320 | get_admin_url(null, '../') => get_admin_url() . '../', |
| | 321 | get_admin_url(null, 'something...here') => get_admin_url() . 'something...here', |
| | 322 | |
| | 323 | // includes_url |
| | 324 | includes_url('../') => includes_url() . '../', |
| | 325 | includes_url('something...here') => includes_url() . 'something...here', |
| | 326 | |
| | 327 | // network_admin_url |
| | 328 | network_admin_url('../') => network_admin_url() . '../', |
| | 329 | network_admin_url('something...here') => network_admin_url() . 'something...here', |
| | 330 | |
| | 331 | // user_admin_url |
| | 332 | user_admin_url('../') => user_admin_url() . '../', |
| | 333 | user_admin_url('something...here') => user_admin_url() . 'something...here', |
| | 334 | |
| | 335 | /** Functions that return a trailing slash **/ |
| | 336 | |
| | 337 | // network_site_url |
| | 338 | network_site_url('../') => network_site_url() . '/../', |
| | 339 | network_site_url('something...here') => network_site_url() . '/something...here', |
| | 340 | |
| | 341 | // get_home_url |
| | 342 | get_home_url(null, '../') => get_home_url() . '/../', |
| | 343 | get_home_url(null, 'something...here') => get_home_url() . '/something...here', |
| | 344 | |
| | 345 | // content_url |
| | 346 | content_url('../') => content_url() . '/../', |
| | 347 | content_url('something...here') => content_url() . '/something...here', |
| | 348 | |
| | 349 | // plugins_url |
| | 350 | plugins_url('../') => plugins_url() . '/../', |
| | 351 | plugins_url('something...here') => plugins_url() . '/something...here', |
| | 352 | |
| | 353 | // network_home_url |
| | 354 | network_home_url('../') => network_home_url() . '/../', |
| | 355 | network_home_url('something...here') => network_home_url() . '/something...here', |
| | 356 | |
| | 357 | ); |
| | 358 | |
| | 359 | foreach ( $test_cases as $actual => $expected ) { |
| | 360 | $this->assertEquals( $expected, $actual ); |
| | 361 | } |
| | 362 | } |