| | 87 | /** |
| | 88 | * Tests for *_url functions |
| | 89 | */ |
| | 90 | class TestURLFunctions extends WPTestCase { |
| | 91 | |
| | 92 | /** |
| | 93 | * Test that *_url functions handle ".." and "..." requests properly. |
| | 94 | * @see http://core.trac.wordpress.org/ticket/19032 |
| | 95 | */ |
| | 96 | public function test_get_home_url() { |
| | 97 | $this->knownWPBug( 19032 ); |
| | 98 | $test_cases = array( |
| | 99 | |
| | 100 | /** Functions that DO NOT return a trailing slash **/ |
| | 101 | |
| | 102 | // get_admin_url |
| | 103 | get_admin_url(null, '../') => get_admin_url() . '../', |
| | 104 | get_admin_url(null, 'something...here') => get_admin_url() . 'something...here', |
| | 105 | |
| | 106 | // includes_url |
| | 107 | includes_url('../') => includes_url() . '../', |
| | 108 | includes_url('something...here') => includes_url() . 'something...here', |
| | 109 | |
| | 110 | // network_admin_url |
| | 111 | network_admin_url('../') => network_admin_url() . '../', |
| | 112 | network_admin_url('something...here') => network_admin_url() . 'something...here', |
| | 113 | |
| | 114 | // user_admin_url |
| | 115 | user_admin_url('../') => user_admin_url() . '../', |
| | 116 | user_admin_url('something...here') => user_admin_url() . 'something...here', |
| | 117 | |
| | 118 | /** Functions that return a trailing slash **/ |
| | 119 | |
| | 120 | // network_site_url |
| | 121 | network_site_url('../') => network_site_url() . '/../', |
| | 122 | network_site_url('something...here') => network_site_url() . '/something...here', |
| | 123 | |
| | 124 | // get_home_url |
| | 125 | get_home_url(null, '../') => get_home_url() . '/../', |
| | 126 | get_home_url(null, 'something...here') => get_home_url() . '/something...here', |
| | 127 | |
| | 128 | // content_url |
| | 129 | content_url('../') => content_url() . '/../', |
| | 130 | content_url('something...here') => content_url() . '/something...here', |
| | 131 | |
| | 132 | // plugins_url |
| | 133 | plugins_url('../') => plugins_url() . '/../', |
| | 134 | plugins_url('something...here') => plugins_url() . '/something...here', |
| | 135 | |
| | 136 | // network_home_url |
| | 137 | network_home_url('../') => network_home_url() . '/../', |
| | 138 | network_home_url('something...here') => network_home_url() . '/something...here', |
| | 139 | |
| | 140 | ); |
| | 141 | |
| | 142 | foreach ( $test_cases as $actual => $expected ) { |
| | 143 | $this->assertEquals( $expected, $actual ); |
| | 144 | } |
| | 145 | } |
| | 146 | } |
| | 147 | |