|
@@ 543-560 (lines=18) @@
|
| 540 |
|
remove_filter( 'jetpack_offline_mode', '__return_zero' ); |
| 541 |
|
} |
| 542 |
|
|
| 543 |
|
function test_get_sync_idc_option_sanitizes_out_www_and_protocol() { |
| 544 |
|
$original_home = get_option( 'home' ); |
| 545 |
|
$original_siteurl = get_option( 'siteurl' ); |
| 546 |
|
|
| 547 |
|
update_option( 'home', 'http://www.coolsite.com' ); |
| 548 |
|
update_option( 'siteurl', 'http://www.coolsite.com/wp' ); |
| 549 |
|
|
| 550 |
|
$expected = array( |
| 551 |
|
'home' => 'coolsite.com/', |
| 552 |
|
'siteurl' => 'coolsite.com/wp/' |
| 553 |
|
); |
| 554 |
|
|
| 555 |
|
$this->assertSame( $expected, Jetpack::get_sync_error_idc_option() ); |
| 556 |
|
|
| 557 |
|
// Cleanup |
| 558 |
|
update_option( 'home', $original_home ); |
| 559 |
|
update_option( 'siteurl', $original_siteurl ); |
| 560 |
|
} |
| 561 |
|
|
| 562 |
|
function test_get_sync_idc_option_with_ip_address_in_option() { |
| 563 |
|
$original_home = get_option( 'home' ); |
|
@@ 562-579 (lines=18) @@
|
| 559 |
|
update_option( 'siteurl', $original_siteurl ); |
| 560 |
|
} |
| 561 |
|
|
| 562 |
|
function test_get_sync_idc_option_with_ip_address_in_option() { |
| 563 |
|
$original_home = get_option( 'home' ); |
| 564 |
|
$original_siteurl = get_option( 'siteurl' ); |
| 565 |
|
|
| 566 |
|
update_option( 'home', 'http://72.182.131.109/~wordpress' ); |
| 567 |
|
update_option( 'siteurl', 'http://72.182.131.109/~wordpress/wp' ); |
| 568 |
|
|
| 569 |
|
$expected = array( |
| 570 |
|
'home' => '72.182.131.109/~wordpress/', |
| 571 |
|
'siteurl' => '72.182.131.109/~wordpress/wp/' |
| 572 |
|
); |
| 573 |
|
|
| 574 |
|
$this->assertSame( $expected, Jetpack::get_sync_error_idc_option() ); |
| 575 |
|
|
| 576 |
|
// Cleanup |
| 577 |
|
update_option( 'home', $original_home ); |
| 578 |
|
update_option( 'siteurl', $original_siteurl ); |
| 579 |
|
} |
| 580 |
|
|
| 581 |
|
function test_normalize_url_protocol_agnostic_strips_protocol_and_www_for_subdir_subdomain() { |
| 582 |
|
$url = 'https://www.subdomain.myfaketestsite.com/what'; |