@@ -204,9 +204,8 @@ function test_sync_jetpack_sync_unlock_sync_callable_action_allows_syncing_siteu
204204
205205 $ this ->server_replica_storage ->reset ();
206206
207- // We set the filters here to simulate how setting the WP_HOME and WP_SITEURL constant works.
208- add_filter ( 'option_home ' , array ( $ this , 'return_https_site_com_blog ' ) );
209- add_filter ( 'option_siteurl ' , array ( $ this , 'return_https_site_com_blog ' ) );
207+ update_option ( 'home ' , $ this ->return_https_site_com_blog () );
208+ update_option ( 'siteurl ' , $ this ->return_https_site_com_blog () );
210209
211210 /**
212211 * Used to signal that the callables await transient should be cleared. Clearing the await transient is useful
@@ -228,8 +227,9 @@ function test_sync_jetpack_sync_unlock_sync_callable_action_allows_syncing_siteu
228227
229228 // Cleanup
230229 unset( $ _SERVER ['HTTPS ' ] );
231- remove_filter ( 'option_home ' , array ( $ this , 'return_https_site_com_blog ' ) );
232- remove_filter ( 'option_siteurl ' , array ( $ this , 'return_https_site_com_blog ' ) );
230+
231+ update_option ( 'home ' , $ original_home_option );
232+ update_option ( 'siteurl ' , $ original_siteurl_option );
233233 }
234234
235235 function test_home_site_urls_synced_while_migrate_for_idc_set () {
@@ -270,25 +270,6 @@ function test_home_site_urls_synced_while_migrate_for_idc_set() {
270270 Jetpack_Options::delete_option ( 'migrate_for_idc ' );
271271 }
272272
273- function test_scheme_switching_does_not_cause_sync () {
274- $ this ->setSyncClientDefaults ();
275- delete_transient ( Jetpack_Sync_Module_Callables::CALLABLES_AWAIT_TRANSIENT_NAME );
276- delete_option ( Jetpack_Sync_Module_Callables::CALLABLES_CHECKSUM_OPTION_NAME );
277- $ _SERVER ['HTTPS ' ] = 'off ' ;
278- $ home_url = home_url ();
279- $ this ->sender ->do_sync ();
280-
281- $ this ->assertEquals ( $ home_url , $ this ->server_replica_storage ->get_callable ( 'home_url ' ) );
282-
283- // this sets is_ssl() to return true.
284- $ _SERVER ['HTTPS ' ] = 'on ' ;
285- delete_transient ( Jetpack_Sync_Module_Callables::CALLABLES_AWAIT_TRANSIENT_NAME );
286- $ this ->sender ->do_sync ();
287-
288- unset( $ _SERVER ['HTTPS ' ] );
289- $ this ->assertEquals ( $ home_url , $ this ->server_replica_storage ->get_callable ( 'home_url ' ) );
290- }
291-
292273 function return_example_com () {
293274 return 'http://example.com ' ;
294275 }
@@ -553,17 +534,17 @@ function test_get_raw_url_returns_with_https_if_is_ssl() {
553534 unset( $ _SERVER ['HTTPS ' ] );
554535 }
555536
556- function test_urls_are_raw_with_use_raw_url_constant () {
537+ function test_user_can_stop_raw_urls () {
557538 add_filter ( 'option_home ' , array ( $ this , '__return_filtered_url ' ) );
558539 add_filter ( 'option_siteurl ' , array ( $ this , '__return_filtered_url ' ) );
559540
560541 // Test with constant first
561- Jetpack_Constants::set_constant ( 'JETPACK_SYNC_USE_RAW_URL ' , true );
562542 $ this ->assertTrue ( 'http://filteredurl.com ' !== Jetpack_Sync_Functions::home_url () );
563- Jetpack_Constants::clear_constants ();
564543
565544 // Now, without, which should return the filtered URL
545+ Jetpack_Constants::set_constant ( 'JETPACK_SYNC_USE_RAW_URL ' , false );
566546 $ this ->assertEquals ( $ this ->__return_filtered_url (), Jetpack_Sync_Functions::home_url () );
547+ Jetpack_Constants::clear_constants ();
567548
568549 remove_filter ( 'option_home ' , array ( $ this , '__return_filtered_url ' ) );
569550 remove_filter ( 'option_siteurl ' , array ( $ this , '__return_filtered_url ' ) );
0 commit comments