| @@ 943-959 (lines=17) @@ | ||
| 940 | $this->assertInternalType( 'int', $status['finished'] ); |
|
| 941 | } |
|
| 942 | ||
| 943 | function test_full_sync_respects_post_and_comment_filters() { |
|
| 944 | add_filter( 'jetpack_sync_prevent_sending_comment_data', '__return_true' ); |
|
| 945 | add_filter( 'jetpack_sync_prevent_sending_post_data', '__return_true' ); |
|
| 946 | ||
| 947 | $post_id = $this->factory->post->create(); |
|
| 948 | $this->factory->comment->create_post_comments( $post_id, 3 ); |
|
| 949 | ||
| 950 | $this->full_sync->start(); |
|
| 951 | $this->sender->do_full_sync(); |
|
| 952 | ||
| 953 | remove_filter( 'jetpack_sync_prevent_sending_comment_data', '__return_true' ); |
|
| 954 | remove_filter( 'jetpack_sync_prevent_sending_post_data', '__return_true' ); |
|
| 955 | ||
| 956 | $this->assertEquals( 3, $this->server_replica_storage->comment_count( 'jetpack_sync_blocked' ) ); |
|
| 957 | $blocked_post = $this->server_replica_storage->get_post( $post_id ); |
|
| 958 | $this->assertEquals( 'jetpack_sync_blocked', $blocked_post->post_status ); |
|
| 959 | } |
|
| 960 | ||
| 961 | function test_full_sync_do_not_sync_events_if_no_data_to_sync() { |
|
| 962 | $non_existent_id = 123123123123123213; |
|
| @@ 1197-1213 (lines=17) @@ | ||
| 1194 | $this->assertInternalType( 'int', $full_sync_status['finished'] ); |
|
| 1195 | } |
|
| 1196 | ||
| 1197 | function test_full_sync_respects_post_and_comment_filters() { |
|
| 1198 | add_filter( 'jetpack_sync_prevent_sending_comment_data', '__return_true' ); |
|
| 1199 | add_filter( 'jetpack_sync_prevent_sending_post_data', '__return_true' ); |
|
| 1200 | ||
| 1201 | $post_id = $this->factory->post->create(); |
|
| 1202 | $this->factory->comment->create_post_comments( $post_id, 3 ); |
|
| 1203 | ||
| 1204 | $this->full_sync->start(); |
|
| 1205 | $this->sender->do_full_sync(); |
|
| 1206 | ||
| 1207 | remove_filter( 'jetpack_sync_prevent_sending_comment_data', '__return_true' ); |
|
| 1208 | remove_filter( 'jetpack_sync_prevent_sending_post_data', '__return_true' ); |
|
| 1209 | ||
| 1210 | $this->assertEquals( 3, $this->server_replica_storage->comment_count( 'jetpack_sync_blocked' ) ); |
|
| 1211 | $blocked_post = $this->server_replica_storage->get_post( $post_id ); |
|
| 1212 | $this->assertEquals( 'jetpack_sync_blocked', $blocked_post->post_status ); |
|
| 1213 | } |
|
| 1214 | ||
| 1215 | function test_full_sync_do_not_sync_events_if_no_data_to_sync() { |
|
| 1216 | $non_existent_id = 123123123123123213; |
|