@@ 541-573 (lines=33) @@ | ||
538 | } |
|
539 | ||
540 | // to test run phpunit -c tests/php.multisite.xml --filter test_full_sync_sends_all_network_options |
|
541 | function test_full_sync_sends_all_network_options() { |
|
542 | if ( ! is_multisite() ) { |
|
543 | $this->markTestSkipped( 'Run it in multi site mode' ); |
|
544 | } |
|
545 | ||
546 | Modules::get_module( "network_options" )->set_network_options_whitelist( array( |
|
547 | 'my_option', |
|
548 | 'my_prefix_value' |
|
549 | ) ); |
|
550 | update_site_option( 'my_option', 'foo' ); |
|
551 | update_site_option( 'my_prefix_value', 'bar' ); |
|
552 | update_site_option( 'my_non_synced_option', 'baz' ); |
|
553 | ||
554 | $this->sender->do_sync(); |
|
555 | ||
556 | // confirm sync worked as expected |
|
557 | $this->assertEquals( 'foo', $this->server_replica_storage->get_site_option( 'my_option' ), '' ); |
|
558 | $this->assertEquals( 'bar', $this->server_replica_storage->get_site_option( 'my_prefix_value' ) ); |
|
559 | $this->assertEquals( null, $this->server_replica_storage->get_site_option( 'my_non_synced_option' ) ); |
|
560 | ||
561 | // reset the storage, check value, and do full sync - storage should be set! |
|
562 | $this->server_replica_storage->reset(); |
|
563 | ||
564 | $this->assertEquals( null, $this->server_replica_storage->get_site_option( 'my_option' ) ); |
|
565 | $this->assertEquals( null, $this->server_replica_storage->get_site_option( 'my_prefix_value' ) ); |
|
566 | ||
567 | $this->full_sync->start(); |
|
568 | $this->sender->do_full_sync(); |
|
569 | ||
570 | $this->assertEquals( 'foo', $this->server_replica_storage->get_site_option( 'my_option' ), 'Network options not synced during full sync' ); |
|
571 | $this->assertEquals( 'bar', $this->server_replica_storage->get_site_option( 'my_prefix_value' ) ); |
|
572 | $this->assertEquals( null, $this->server_replica_storage->get_site_option( 'my_non_synced_option' ) ); |
|
573 | } |
|
574 | ||
575 | function test_full_sync_sends_all_post_meta() { |
|
576 | $post_id = $this->factory->post->create(); |
@@ 715-747 (lines=33) @@ | ||
712 | } |
|
713 | ||
714 | // to test run phpunit -c tests/php.multisite.xml --filter test_full_sync_sends_all_network_options |
|
715 | function test_full_sync_sends_all_network_options() { |
|
716 | if ( ! is_multisite() ) { |
|
717 | $this->markTestSkipped( 'Run it in multi site mode' ); |
|
718 | } |
|
719 | ||
720 | Modules::get_module( "network_options" )->set_network_options_whitelist( array( |
|
721 | 'my_option', |
|
722 | 'my_prefix_value' |
|
723 | ) ); |
|
724 | update_site_option( 'my_option', 'foo' ); |
|
725 | update_site_option( 'my_prefix_value', 'bar' ); |
|
726 | update_site_option( 'my_non_synced_option', 'baz' ); |
|
727 | ||
728 | $this->sender->do_sync(); |
|
729 | ||
730 | // confirm sync worked as expected |
|
731 | $this->assertEquals( 'foo', $this->server_replica_storage->get_site_option( 'my_option' ), '' ); |
|
732 | $this->assertEquals( 'bar', $this->server_replica_storage->get_site_option( 'my_prefix_value' ) ); |
|
733 | $this->assertEquals( null, $this->server_replica_storage->get_site_option( 'my_non_synced_option' ) ); |
|
734 | ||
735 | // reset the storage, check value, and do full sync - storage should be set! |
|
736 | $this->server_replica_storage->reset(); |
|
737 | ||
738 | $this->assertEquals( null, $this->server_replica_storage->get_site_option( 'my_option' ) ); |
|
739 | $this->assertEquals( null, $this->server_replica_storage->get_site_option( 'my_prefix_value' ) ); |
|
740 | ||
741 | $this->full_sync->start(); |
|
742 | $this->sender->do_full_sync(); |
|
743 | ||
744 | $this->assertEquals( 'foo', $this->server_replica_storage->get_site_option( 'my_option' ), 'Network options not synced during full sync' ); |
|
745 | $this->assertEquals( 'bar', $this->server_replica_storage->get_site_option( 'my_prefix_value' ) ); |
|
746 | $this->assertEquals( null, $this->server_replica_storage->get_site_option( 'my_non_synced_option' ) ); |
|
747 | } |
|
748 | ||
749 | function test_full_sync_sends_all_post_meta() { |
|
750 | $post_id = $this->factory->post->create(); |