| @@ 575-605 (lines=31) @@ | ||
| 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(); |
|
| 577 | ||
| 578 | Settings::update_settings( array( 'post_meta_whitelist' => array( 'test_meta_key', 'test_meta_array' ) ) ); |
|
| 579 | ||
| 580 | add_post_meta( $post_id, 'test_meta_key', 'foo' ); |
|
| 581 | add_post_meta( $post_id, 'test_meta_array', array( 'foo', 'bar' ) ); |
|
| 582 | ||
| 583 | $this->sender->do_sync(); |
|
| 584 | ||
| 585 | $this->assertEquals( 'foo', $this->server_replica_storage->get_metadata( 'post', $post_id, 'test_meta_key', true ) ); |
|
| 586 | $this->assertEquals( array( |
|
| 587 | 'foo', |
|
| 588 | 'bar' |
|
| 589 | ), $this->server_replica_storage->get_metadata( 'post', $post_id, 'test_meta_array', true ) ); |
|
| 590 | ||
| 591 | // reset the storage, check value, and do full sync - storage should be set! |
|
| 592 | $this->server_replica_storage->reset(); |
|
| 593 | ||
| 594 | $this->assertEquals( null, $this->server_replica_storage->get_metadata( 'post', $post_id, 'test_meta_key', true ) ); |
|
| 595 | $this->assertEquals( null, $this->server_replica_storage->get_metadata( 'post', $post_id, 'test_meta_array', true ) ); |
|
| 596 | ||
| 597 | $this->full_sync->start(); |
|
| 598 | $this->sender->do_full_sync(); |
|
| 599 | ||
| 600 | $this->assertEquals( 'foo', $this->server_replica_storage->get_metadata( 'post', $post_id, 'test_meta_key', true ) ); |
|
| 601 | $this->assertEquals( array( |
|
| 602 | 'foo', |
|
| 603 | 'bar' |
|
| 604 | ), $this->server_replica_storage->get_metadata( 'post', $post_id, 'test_meta_array', true ) ); |
|
| 605 | } |
|
| 606 | ||
| 607 | function test_full_sync_doesnt_sends_forbiden_private_or_public_post_meta() { |
|
| 608 | $post_id = $this->factory->post->create(); |
|
| @@ 749-773 (lines=25) @@ | ||
| 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(); |
|
| 751 | ||
| 752 | Settings::update_settings( array( 'post_meta_whitelist' => array( 'test_meta_key', 'test_meta_array' ) ) ); |
|
| 753 | ||
| 754 | add_post_meta( $post_id, 'test_meta_key', 'foo' ); |
|
| 755 | add_post_meta( $post_id, 'test_meta_array', array( 'foo', 'bar' ) ); |
|
| 756 | ||
| 757 | $this->sender->do_sync(); |
|
| 758 | ||
| 759 | $this->assertEquals( 'foo', $this->server_replica_storage->get_metadata( 'post', $post_id, 'test_meta_key', true ) ); |
|
| 760 | $this->assertEquals( array( 'foo', 'bar' ), $this->server_replica_storage->get_metadata( 'post', $post_id, 'test_meta_array', true ) ); |
|
| 761 | ||
| 762 | // reset the storage, check value, and do full sync - storage should be set! |
|
| 763 | $this->server_replica_storage->reset(); |
|
| 764 | ||
| 765 | $this->assertEquals( null, $this->server_replica_storage->get_metadata( 'post', $post_id, 'test_meta_key', true ) ); |
|
| 766 | $this->assertEquals( null, $this->server_replica_storage->get_metadata( 'post', $post_id, 'test_meta_array', true ) ); |
|
| 767 | ||
| 768 | $this->full_sync->start(); |
|
| 769 | $this->sender->do_full_sync(); |
|
| 770 | ||
| 771 | $this->assertEquals( 'foo', $this->server_replica_storage->get_metadata( 'post', $post_id, 'test_meta_key', true ) ); |
|
| 772 | $this->assertEquals( array( 'foo', 'bar' ), $this->server_replica_storage->get_metadata( 'post', $post_id, 'test_meta_array', true ) ); |
|
| 773 | } |
|
| 774 | ||
| 775 | function test_full_sync_doesnt_sends_forbiden_private_or_public_post_meta() { |
|
| 776 | $post_id = $this->factory->post->create(); |
|