Skip to content

Commit d90d1f2

Browse files
committed
Sync: Fix failing test after updating multisite logic
1 parent 9fcd051 commit d90d1f2

1 file changed

Lines changed: 12 additions & 7 deletions

File tree

tests/php/sync/test_class.jetpack-sync-callables.php

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ function test_sync_always_sync_changes_to_modules_right_away() {
146146
Jetpack::update_active_modules( array( 'stats' ) );
147147

148148
$this->sender->do_sync();
149-
149+
150150
$synced_value = $this->server_replica_storage->get_callable( 'active_modules' );
151151
$this->assertEquals( array( 'stats' ), $synced_value );
152152

@@ -394,7 +394,7 @@ function test_get_protocol_normalized_url_cleared_on_reset_data() {
394394
}
395395

396396
function test_subdomain_switching_to_www_does_not_cause_sync() {
397-
// a lot of sites accept www.domain.com or just domain.com, and we want to prevent lots of
397+
// a lot of sites accept www.domain.com or just domain.com, and we want to prevent lots of
398398
// switching back and forth, so we force the domain to be the one in the siteurl option
399399
$this->setSyncClientDefaults();
400400
delete_transient( Jetpack_Sync_Module_Callables::CALLABLES_AWAIT_TRANSIENT_NAME );
@@ -429,7 +429,7 @@ function test_only_syncs_if_is_admin_and_not_cron() {
429429

430430
$this->sender->do_sync();
431431
$this->assertEquals( null, $this->server_replica_storage->get_callable( 'site_url' ) );
432-
432+
433433
Jetpack_Sync_Settings::set_doing_cron( false );
434434
$this->sender->do_sync();
435435
$this->assertEquals( site_url(), $this->server_replica_storage->get_callable( 'site_url' ) );
@@ -481,7 +481,7 @@ function test_calling_taxonomies_do_not_modify_global() {
481481
}
482482

483483
function test_sanitize_sync_taxonomies_method() {
484-
484+
485485
$sanitized = Jetpack_Sync_Functions::sanitize_taxonomy( (object) array( 'meta_box_cb' => 'post_tags_meta_box' ) );
486486
$this->assertEquals( $sanitized->meta_box_cb, 'post_tags_meta_box' );
487487

@@ -513,8 +513,13 @@ function test_get_raw_url_by_constant_bypasses_filters() {
513513
add_filter( 'option_home', array( $this, '__return_filtered_url' ) );
514514
add_filter( 'option_siteurl', array( $this, '__return_filtered_url' ) );
515515

516-
$this->assertEquals( 'http://constanturl.com', Jetpack_Sync_Functions::get_raw_url( 'home' ) );
517-
$this->assertEquals( 'http://constanturl.com', Jetpack_Sync_Functions::get_raw_url( 'siteurl' ) );
516+
if ( is_multisite() ) {
517+
$this->assertTrue( $this->__return_filtered_url() !== Jetpack_Sync_Functions::get_raw_url( 'home' ) );
518+
$this->assertTrue( $this->__return_filtered_url() !== Jetpack_Sync_Functions::get_raw_url( 'siteurl' ) );
519+
} else {
520+
$this->assertEquals( 'http://constanturl.com', Jetpack_Sync_Functions::get_raw_url( 'home' ) );
521+
$this->assertEquals( 'http://constanturl.com', Jetpack_Sync_Functions::get_raw_url( 'siteurl' ) );
522+
}
518523

519524
remove_filter( 'option_home', array( $this, '__return_filtered_url' ) );
520525
remove_filter( 'option_siteurl', array( $this, '__return_filtered_url' ) );
@@ -601,7 +606,7 @@ function test_plugin_action_links_get_synced() {
601606
function __return_filtered_url() {
602607
return 'http://filteredurl.com';
603608
}
604-
609+
605610
function add_www_subdomain_to_siteurl( $url ) {
606611
$parsed_url = parse_url( $url );
607612

0 commit comments

Comments
 (0)