@@ -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
@@ -536,6 +536,26 @@ function test_get_raw_url_returns_with_http_if_is_ssl() {
536536 unset( $ _SERVER ['HTTPS ' ] );
537537 }
538538
539+ function test_raw_home_url_is_https_when_is_ssl () {
540+ Jetpack_Constants::set_constant ( 'JETPACK_SYNC_USE_RAW_URL ' , true );
541+
542+ $ home_option = get_option ( 'home ' );
543+
544+ // Test without https first
545+ $ this ->assertEquals (
546+ $ home_option ,
547+ Jetpack_Sync_Functions::home_url ()
548+ );
549+
550+ // Now, with https
551+ $ _SERVER ['HTTPS ' ] = 'on ' ;
552+ $ this ->assertEquals (
553+ set_url_scheme ( $ home_option , 'https ' ),
554+ Jetpack_Sync_Functions::home_url ()
555+ );
556+ unset( $ _SERVER ['HTTPS ' ] );
557+ }
558+
539559 function test_user_can_stop_raw_urls () {
540560 add_filter ( 'option_home ' , array ( $ this , '__return_filtered_url ' ) );
541561 add_filter ( 'option_siteurl ' , array ( $ this , '__return_filtered_url ' ) );
@@ -601,7 +621,7 @@ function test_plugin_action_links_get_synced() {
601621 function __return_filtered_url () {
602622 return 'http://filteredurl.com ' ;
603623 }
604-
624+
605625 function add_www_subdomain_to_siteurl ( $ url ) {
606626 $ parsed_url = parse_url ( $ url );
607627
0 commit comments