Changeset 48937 for trunk/tests/phpunit/tests/url.php
- Timestamp:
- 09/02/2020 12:35:36 AM (3 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/url.php
r47122 r48937 78 78 $admin_url_https = admin_url( $url ); 79 79 80 $this->assert Equals( $siteurl_http . $expected, $admin_url_http );81 $this->assert Equals( $siteurl_https . $expected, $admin_url_https );80 $this->assertSame( $siteurl_http . $expected, $admin_url_http ); 81 $this->assertSame( $siteurl_https . $expected, $admin_url_https ); 82 82 } 83 83 … … 146 146 $home_url_https = home_url( $url ); 147 147 148 $this->assert Equals( $homeurl_http . $expected, $home_url_http );149 $this->assert Equals( $homeurl_https . $expected, $home_url_https );148 $this->assertSame( $homeurl_http . $expected, $home_url_http ); 149 $this->assertSame( $homeurl_https . $expected, $home_url_https ); 150 150 } 151 151 … … 208 208 // home_url() should return http when in the admin. 209 209 $_SERVER['HTTPS'] = 'on'; 210 $this->assert Equals( $home, home_url() );210 $this->assertSame( $home, home_url() ); 211 211 212 212 $_SERVER['HTTPS'] = 'off'; 213 $this->assert Equals( $home, home_url() );213 $this->assertSame( $home, home_url() ); 214 214 215 215 // If not in the admin, is_ssl() should determine the scheme. 216 216 set_current_screen( 'front' ); 217 $this->assert Equals( $home, home_url() );217 $this->assertSame( $home, home_url() ); 218 218 $_SERVER['HTTPS'] = 'on'; 219 219 $home = str_replace( 'http://', 'https://', $home ); 220 $this->assert Equals( $home, home_url() );220 $this->assertSame( $home, home_url() ); 221 221 222 222 // Test with https in home. … … 229 229 // home_url() should return whatever scheme is set in the home option when in the admin. 230 230 $_SERVER['HTTPS'] = 'on'; 231 $this->assert Equals( $home, home_url() );231 $this->assertSame( $home, home_url() ); 232 232 233 233 $_SERVER['HTTPS'] = 'off'; 234 $this->assert Equals( $home, home_url() );234 $this->assertSame( $home, home_url() ); 235 235 236 236 // If not in the admin, is_ssl() should determine the scheme unless https hard-coded in home. 237 237 set_current_screen( 'front' ); 238 $this->assert Equals( $home, home_url() );239 $_SERVER['HTTPS'] = 'on'; 240 $this->assert Equals( $home, home_url() );238 $this->assertSame( $home, home_url() ); 239 $_SERVER['HTTPS'] = 'on'; 240 $this->assertSame( $home, home_url() ); 241 241 $_SERVER['HTTPS'] = 'off'; 242 $this->assert Equals( $home, home_url() );242 $this->assertSame( $home, home_url() ); 243 243 244 244 update_option( 'home', set_url_scheme( $home, 'http' ) ); … … 255 255 256 256 // home_url() should return http when in the admin. 257 $this->assert Equals( 0, strpos( $home, 'http://' ) );258 $_SERVER['HTTPS'] = 'on'; 259 $this->assert Equals( $home, network_home_url() );257 $this->assertSame( 0, strpos( $home, 'http://' ) ); 258 $_SERVER['HTTPS'] = 'on'; 259 $this->assertSame( $home, network_home_url() ); 260 260 261 261 $_SERVER['HTTPS'] = 'off'; 262 $this->assert Equals( $home, network_home_url() );262 $this->assertSame( $home, network_home_url() ); 263 263 264 264 // If not in the admin, is_ssl() should determine the scheme. 265 265 set_current_screen( 'front' ); 266 $this->assert Equals( $home, network_home_url() );266 $this->assertSame( $home, network_home_url() ); 267 267 $_SERVER['HTTPS'] = 'on'; 268 268 $home = str_replace( 'http://', 'https://', $home ); 269 $this->assert Equals( $home, network_home_url() );269 $this->assertSame( $home, network_home_url() ); 270 270 271 271 $GLOBALS['current_screen'] = $screen; … … 308 308 $i = 0; 309 309 foreach ( $links as $link ) { 310 $this->assert Equals( $https_links[ $i ], set_url_scheme( $link, 'https' ) );311 $this->assert Equals( $http_links[ $i ], set_url_scheme( $link, 'http' ) );312 $this->assert Equals( $relative_links[ $i ], set_url_scheme( $link, 'relative' ) );310 $this->assertSame( $https_links[ $i ], set_url_scheme( $link, 'https' ) ); 311 $this->assertSame( $http_links[ $i ], set_url_scheme( $link, 'http' ) ); 312 $this->assertSame( $relative_links[ $i ], set_url_scheme( $link, 'relative' ) ); 313 313 314 314 $_SERVER['HTTPS'] = 'on'; 315 $this->assert Equals( $https_links[ $i ], set_url_scheme( $link ) );315 $this->assertSame( $https_links[ $i ], set_url_scheme( $link ) ); 316 316 317 317 $_SERVER['HTTPS'] = 'off'; 318 $this->assert Equals( $http_links[ $i ], set_url_scheme( $link ) );318 $this->assertSame( $http_links[ $i ], set_url_scheme( $link ) ); 319 319 320 320 force_ssl_admin( true ); 321 $this->assert Equals( $https_links[ $i ], set_url_scheme( $link, 'admin' ) );322 $this->assert Equals( $https_links[ $i ], set_url_scheme( $link, 'login_post' ) );323 $this->assert Equals( $https_links[ $i ], set_url_scheme( $link, 'login' ) );324 $this->assert Equals( $https_links[ $i ], set_url_scheme( $link, 'rpc' ) );321 $this->assertSame( $https_links[ $i ], set_url_scheme( $link, 'admin' ) ); 322 $this->assertSame( $https_links[ $i ], set_url_scheme( $link, 'login_post' ) ); 323 $this->assertSame( $https_links[ $i ], set_url_scheme( $link, 'login' ) ); 324 $this->assertSame( $https_links[ $i ], set_url_scheme( $link, 'rpc' ) ); 325 325 326 326 force_ssl_admin( false ); 327 $this->assert Equals( $http_links[ $i ], set_url_scheme( $link, 'admin' ) );328 $this->assert Equals( $http_links[ $i ], set_url_scheme( $link, 'login_post' ) );329 $this->assert Equals( $http_links[ $i ], set_url_scheme( $link, 'login' ) );330 $this->assert Equals( $http_links[ $i ], set_url_scheme( $link, 'rpc' ) );327 $this->assertSame( $http_links[ $i ], set_url_scheme( $link, 'admin' ) ); 328 $this->assertSame( $http_links[ $i ], set_url_scheme( $link, 'login_post' ) ); 329 $this->assertSame( $http_links[ $i ], set_url_scheme( $link, 'login' ) ); 330 $this->assertSame( $http_links[ $i ], set_url_scheme( $link, 'rpc' ) ); 331 331 332 332 $i++; … … 349 349 $p = get_adjacent_post(); 350 350 $this->assertInstanceOf( 'WP_Post', $p ); 351 $this->assert Equals( $post_id, $p->ID );351 $this->assertSame( $post_id, $p->ID ); 352 352 353 353 // The same again to make sure a cached query returns the same result. 354 354 $p = get_adjacent_post(); 355 355 $this->assertInstanceOf( 'WP_Post', $p ); 356 $this->assert Equals( $post_id, $p->ID );356 $this->assertSame( $post_id, $p->ID ); 357 357 358 358 // Test next. 359 359 $p = get_adjacent_post( false, '', false ); 360 $this->assert Equals( '', $p );360 $this->assertSame( '', $p ); 361 361 362 362 unset( $GLOBALS['post'] ); … … 399 399 400 400 $p = get_adjacent_post(); 401 $this->assert Equals( $p1, $p->ID );401 $this->assertSame( $p1, $p->ID ); 402 402 403 403 $GLOBALS['post'] = $orig_post; … … 437 437 438 438 $p = get_adjacent_post(); 439 $this->assert Equals( $p1, $p->ID );439 $this->assertSame( $p1, $p->ID ); 440 440 441 441 $GLOBALS['post'] = $orig_post; … … 481 481 482 482 $p = get_adjacent_post(); 483 $this->assert Equals( $p1, $p->ID );483 $this->assertSame( $p1, $p->ID ); 484 484 485 485 $GLOBALS['post'] = $orig_post; … … 507 507 508 508 foreach ( $functions as $function ) { 509 $this->assert Equals(509 $this->assertSame( 510 510 call_user_func( $function, '/' ) . '../', 511 511 call_user_func( $function, '../' ) 512 512 ); 513 $this->assert Equals(513 $this->assertSame( 514 514 call_user_func( $function, '/' ) . 'something...here', 515 515 call_user_func( $function, 'something...here' ) … … 519 519 // These functions accept a blog ID argument. 520 520 foreach ( array( 'get_site_url', 'get_home_url', 'get_admin_url' ) as $function ) { 521 $this->assert Equals(521 $this->assertSame( 522 522 call_user_func( $function, null, '/' ) . '../', 523 523 call_user_func( $function, null, '../' ) 524 524 ); 525 $this->assert Equals(525 $this->assertSame( 526 526 call_user_func( $function, null, '/' ) . 'something...here', 527 527 call_user_func( $function, null, 'something...here' )
Note: See TracChangeset
for help on using the changeset viewer.