| | 155 | |
| | 156 | // Test with https in home |
| | 157 | update_option( 'home', set_url_scheme( $home, 'https' ) ); |
| | 158 | |
| | 159 | // Pretend to be in the site admin |
| | 160 | set_current_screen( 'dashboard' ); |
| | 161 | $home = get_option('home'); |
| | 162 | |
| | 163 | // home_url() should return whatever scheme is set in the home option when in the admin |
| | 164 | $_SERVER['HTTPS'] = 'on'; |
| | 165 | $this->assertEquals( $home, home_url() ); |
| | 166 | |
| | 167 | $_SERVER['HTTPS'] = 'off'; |
| | 168 | $this->assertEquals( $home, home_url() ); |
| | 169 | |
| | 170 | // If not in the admin, is_ssl() should determine the scheme unless https hard-coded in home |
| | 171 | set_current_screen( 'front' ); |
| | 172 | $this->assertEquals( $home, home_url() ); |
| | 173 | $_SERVER['HTTPS'] = 'on'; |
| | 174 | $this->assertEquals( $home, home_url() ); |
| | 175 | $_SERVER['HTTPS'] = 'off'; |
| | 176 | $this->assertEquals( $home, home_url() ); |
| | 177 | |
| | 178 | update_option( 'home', set_url_scheme( $home, 'http' ) ); |
| | 179 | |