|
@@ 428-442 (lines=15) @@
|
| 425 |
|
/** |
| 426 |
|
* Verify that validate_sync_error returns false if wpcom_ is set and matches expected. |
| 427 |
|
*/ |
| 428 |
|
public function test_sync_error_idc_validation_returns_false_when_wpcom_option_matches_expected() { |
| 429 |
|
add_filter( 'jetpack_sync_idc_optin', '__return_true' ); |
| 430 |
|
$option = Jetpack::get_sync_error_idc_option(); |
| 431 |
|
$option['wpcom_home'] = $option['home']; |
| 432 |
|
$option['wpcom_siteurl'] = $option['siteurl']; |
| 433 |
|
Jetpack_Options::update_option( 'sync_error_idc', $option ); |
| 434 |
|
$this->assertFalse( Jetpack::validate_sync_error_idc_option() ); |
| 435 |
|
|
| 436 |
|
// Verify the migrate_for_idc is set. |
| 437 |
|
$this->assertTrue( Jetpack_Options::get_option( 'migrate_for_idc' ) ); |
| 438 |
|
|
| 439 |
|
Jetpack_Options::delete_option( 'sync_error_idc' ); |
| 440 |
|
Jetpack_Options::delete_option( 'migrate_for_idc' ); |
| 441 |
|
remove_filter( 'jetpack_sync_idc_optin', '__return_true' ); |
| 442 |
|
} |
| 443 |
|
|
| 444 |
|
/** |
| 445 |
|
* Verify that validate_sync_error returns true if wpcom_ is set and does not match. |
|
@@ 447-461 (lines=15) @@
|
| 444 |
|
/** |
| 445 |
|
* Verify that validate_sync_error returns true if wpcom_ is set and does not match. |
| 446 |
|
*/ |
| 447 |
|
public function test_sync_error_idc_validation_returns_true_when_wpcom_option_does_not_match_expected() { |
| 448 |
|
add_filter( 'jetpack_sync_idc_optin', '__return_true' ); |
| 449 |
|
$option = Jetpack::get_sync_error_idc_option(); |
| 450 |
|
$option['wpcom_home'] = $option['home']; |
| 451 |
|
$option['wpcom_siteurl'] = 'coolrunnings.test'; |
| 452 |
|
Jetpack_Options::update_option( 'sync_error_idc', $option ); |
| 453 |
|
$this->assertTrue( Jetpack::validate_sync_error_idc_option() ); |
| 454 |
|
|
| 455 |
|
// Verify the migrate_for_idc is not set. |
| 456 |
|
$this->assertNotTrue( Jetpack_Options::get_option( 'migrate_for_idc' ) ); |
| 457 |
|
|
| 458 |
|
Jetpack_Options::delete_option( 'sync_error_idc' ); |
| 459 |
|
Jetpack_Options::delete_option( 'migrate_for_idc' ); |
| 460 |
|
remove_filter( 'jetpack_sync_idc_optin', '__return_true' ); |
| 461 |
|
} |
| 462 |
|
|
| 463 |
|
function test_sync_error_idc_validation_cleans_up_when_validation_fails() { |
| 464 |
|
Jetpack_Options::update_option( 'sync_error_idc', array( |