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