@@ 1258-1274 (lines=17) @@ | ||
1255 | /** |
|
1256 | * Verify get_check_sum is consistent for differently ordered arrays. |
|
1257 | */ |
|
1258 | public function test_sync_does_not_send_updates_if_array_order_is_only_change() { |
|
1259 | $plugins = Functions::get_plugins(); |
|
1260 | ||
1261 | // Let's see if the original values get synced. |
|
1262 | $this->sender->do_sync(); |
|
1263 | $plugins_synced = $this->server_replica_storage->get_callable( 'get_plugins' ); |
|
1264 | ||
1265 | $this->assertEquals( $plugins, $plugins_synced ); |
|
1266 | ||
1267 | add_filter( 'all_plugins', array( $this, 'reorder_array_keys' ), 100, 1 ); |
|
1268 | do_action( 'jetpack_sync_unlock_sync_callable' ); |
|
1269 | $this->server_event_storage->reset(); |
|
1270 | $this->sender->do_sync(); |
|
1271 | ||
1272 | $event = $this->server_event_storage->get_most_recent_event( 'jetpack_sync_callable' ); |
|
1273 | $this->assertFalse( $event ); |
|
1274 | } |
|
1275 | ||
1276 | /** |
|
1277 | * Reorder the get_plugins array keys. |
@@ 618-636 (lines=19) @@ | ||
615 | /** |
|
616 | * Tests that jetpack_sync_save_post events are not sent for blacklisted post_types |
|
617 | */ |
|
618 | function test_filters_out_blacklisted_post_types() { |
|
619 | $args = array( |
|
620 | 'public' => true, |
|
621 | 'label' => 'Snitch' |
|
622 | ); |
|
623 | register_post_type( 'snitch', $args ); |
|
624 | $this->server_event_storage->reset(); |
|
625 | ||
626 | $post_id = $this->factory->post->create( array( 'post_type' => 'snitch' ) ); |
|
627 | ||
628 | $this->sender->do_sync(); |
|
629 | ||
630 | // Clean up. |
|
631 | unregister_post_type( 'snitch' ); |
|
632 | ||
633 | $this->assertFalse( $this->server_replica_storage->get_post( $post_id ) ); |
|
634 | $sync_event = $this->server_event_storage->get_most_recent_event( 'jetpack_sync_save_post' ); |
|
635 | $this->assertFalse( $sync_event ); |
|
636 | } |
|
637 | ||
638 | /** |
|
639 | * Tests that jetpack_published_post events are not sent for blacklisted post_types. |
|
@@ 641-659 (lines=19) @@ | ||
638 | /** |
|
639 | * Tests that jetpack_published_post events are not sent for blacklisted post_types. |
|
640 | */ |
|
641 | public function test_filters_out_blacklisted_post_types_jetpack_published_post() { |
|
642 | $args = array( |
|
643 | 'public' => true, |
|
644 | 'label' => 'Snitch', |
|
645 | ); |
|
646 | register_post_type( 'snitch', $args ); |
|
647 | $this->server_event_storage->reset(); |
|
648 | ||
649 | $post_id = $this->factory->post->create( array( 'post_type' => 'snitch' ) ); |
|
650 | ||
651 | $this->sender->do_sync(); |
|
652 | ||
653 | // Clean up. |
|
654 | unregister_post_type( 'snitch' ); |
|
655 | ||
656 | $this->assertFalse( $this->server_replica_storage->get_post( $post_id ) ); |
|
657 | $sync_event = $this->server_event_storage->get_most_recent_event( 'jetpack_published_post' ); |
|
658 | $this->assertFalse( $sync_event ); |
|
659 | } |
|
660 | ||
661 | /** |
|
662 | * Tests that deleted_post events are not sent for blacklisted post_types. |