Changeset 50156 for trunk/tests/phpunit/tests/url.php
- Timestamp:
- 02/02/2021 07:01:18 PM (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/url.php
r48937 r50156 204 204 // Pretend to be in the site admin. 205 205 set_current_screen( 'dashboard' ); 206 $home = get_option( 'home' ); 207 208 // home_url() should return http when in the admin. 209 $_SERVER['HTTPS'] = 'on'; 210 $this->assertSame( $home, home_url() ); 206 $home = get_option( 'home' ); 207 $home_https = str_replace( 'http://', 'https://', $home ); 208 209 // is_ssl() should determine the scheme in the admin. 210 $_SERVER['HTTPS'] = 'on'; 211 $this->assertSame( $home_https, home_url() ); 211 212 212 213 $_SERVER['HTTPS'] = 'off'; 213 214 $this->assertSame( $home, home_url() ); 214 215 215 // If not in the admin, is_ssl() should determine the scheme.216 // is_ssl() should determine the scheme on front end too. 216 217 set_current_screen( 'front' ); 217 218 $this->assertSame( $home, home_url() ); 218 $_SERVER['HTTPS'] = 'on'; 219 $ home = str_replace( 'http://', 'https://', $home );220 $this->assertSame( $home , home_url() );219 220 $_SERVER['HTTPS'] = 'on'; 221 $this->assertSame( $home_https, home_url() ); 221 222 222 223 // Test with https in home. … … 252 253 // Pretend to be in the site admin. 253 254 set_current_screen( 'dashboard' ); 254 $home = network_home_url(); 255 256 // home_url() should return http when in the admin. 255 $home = network_home_url(); 256 $home_https = str_replace( 'http://', 'https://', $home ); 257 258 // is_ssl() should determine the scheme in the admin. 257 259 $this->assertSame( 0, strpos( $home, 'http://' ) ); 258 260 $_SERVER['HTTPS'] = 'on'; 259 $this->assertSame( $home , network_home_url() );261 $this->assertSame( $home_https, network_home_url() ); 260 262 261 263 $_SERVER['HTTPS'] = 'off'; 262 264 $this->assertSame( $home, network_home_url() ); 263 265 264 // If not in the admin, is_ssl() should determine the scheme.266 // is_ssl() should determine the scheme on front end too. 265 267 set_current_screen( 'front' ); 266 268 $this->assertSame( $home, network_home_url() ); 267 269 $_SERVER['HTTPS'] = 'on'; 268 $home = str_replace( 'http://', 'https://', $home ); 269 $this->assertSame( $home, network_home_url() ); 270 $this->assertSame( $home_https, network_home_url() ); 270 271 271 272 $GLOBALS['current_screen'] = $screen;
Note: See TracChangeset
for help on using the changeset viewer.