@@ 1045-1062 (lines=18) @@ | ||
1042 | $this->assertEquals( array( $sync_user_id, $sync_user_id_2 ), $sync_status['config']['users'] ); |
|
1043 | } |
|
1044 | ||
1045 | function test_full_sync_doesnt_send_deleted_posts() { |
|
1046 | // previously, the behavior was to send false or throw errors - we |
|
1047 | // should actively detect false values and remove them |
|
1048 | $keep_post_id = $this->factory->post->create(); |
|
1049 | $delete_post_id = $this->factory->post->create(); |
|
1050 | ||
1051 | $this->full_sync->start(); |
|
1052 | ||
1053 | wp_delete_post( $delete_post_id, true ); |
|
1054 | ||
1055 | $this->sender->do_full_sync(); |
|
1056 | ||
1057 | $synced_posts_event = $this->server_event_storage->get_most_recent_event( 'jetpack_full_sync_posts' ); |
|
1058 | ||
1059 | $posts = $synced_posts_event->args[0]; |
|
1060 | $this->assertEquals( 1, count( $posts ) ); |
|
1061 | $this->assertEquals( $keep_post_id, $posts[0]->ID ); |
|
1062 | } |
|
1063 | ||
1064 | function test_full_sync_doesnt_send_deleted_comments() { |
|
1065 | // previously, the behavior was to send false or throw errors - we |
|
@@ 1064-1081 (lines=18) @@ | ||
1061 | $this->assertEquals( $keep_post_id, $posts[0]->ID ); |
|
1062 | } |
|
1063 | ||
1064 | function test_full_sync_doesnt_send_deleted_comments() { |
|
1065 | // previously, the behavior was to send false or throw errors - we |
|
1066 | // should actively detect false values and remove them |
|
1067 | $post_id = $this->factory->post->create(); |
|
1068 | list( $keep_comment_id, $delete_comment_id ) = $this->factory->comment->create_post_comments( $post_id, 2 ); |
|
1069 | ||
1070 | $this->full_sync->start(); |
|
1071 | ||
1072 | wp_delete_comment( $delete_comment_id, true ); |
|
1073 | ||
1074 | $this->sender->do_full_sync(); |
|
1075 | ||
1076 | $synced_comments_event = $this->server_event_storage->get_most_recent_event( 'jetpack_full_sync_comments' ); |
|
1077 | ||
1078 | $comments = $synced_comments_event->args[0]; |
|
1079 | $this->assertEquals( 1, count( $comments ) ); |
|
1080 | $this->assertEquals( $keep_comment_id, $comments[0]->comment_ID ); |
|
1081 | } |
|
1082 | ||
1083 | function test_full_sync_doesnt_send_deleted_users() { |
|
1084 | $user_counts = count_users(); |
@@ 1295-1313 (lines=19) @@ | ||
1292 | $this->assertEquals( array( $sync_user_id, $sync_user_id_2 ), $sync_status['config']['users'] ); |
|
1293 | } |
|
1294 | ||
1295 | function test_full_sync_doesnt_send_deleted_posts() { |
|
1296 | ||
1297 | // previously, the behavior was to send false or throw errors - we |
|
1298 | // should actively detect false values and remove them |
|
1299 | $keep_post_id = $this->factory->post->create(); |
|
1300 | $delete_post_id = $this->factory->post->create(); |
|
1301 | ||
1302 | $this->full_sync->start(); |
|
1303 | ||
1304 | wp_delete_post( $delete_post_id, true ); |
|
1305 | ||
1306 | $this->sender->do_full_sync(); |
|
1307 | ||
1308 | $synced_posts_event = $this->server_event_storage->get_most_recent_event( 'jetpack_full_sync_posts' ); |
|
1309 | ||
1310 | $posts = $synced_posts_event->args[0]; |
|
1311 | $this->assertEquals( 1, count( $posts ) ); |
|
1312 | $this->assertEquals( $keep_post_id, $posts[0]->ID ); |
|
1313 | } |
|
1314 | ||
1315 | function test_full_sync_doesnt_send_deleted_comments() { |
|
1316 | ||
@@ 1315-1333 (lines=19) @@ | ||
1312 | $this->assertEquals( $keep_post_id, $posts[0]->ID ); |
|
1313 | } |
|
1314 | ||
1315 | function test_full_sync_doesnt_send_deleted_comments() { |
|
1316 | ||
1317 | // previously, the behavior was to send false or throw errors - we |
|
1318 | // should actively detect false values and remove them |
|
1319 | $post_id = $this->factory->post->create(); |
|
1320 | list( $keep_comment_id, $delete_comment_id ) = $this->factory->comment->create_post_comments( $post_id, 2 ); |
|
1321 | ||
1322 | $this->full_sync->start(); |
|
1323 | ||
1324 | wp_delete_comment( $delete_comment_id, true ); |
|
1325 | ||
1326 | $this->sender->do_full_sync(); |
|
1327 | ||
1328 | $synced_comments_event = $this->server_event_storage->get_most_recent_event( 'jetpack_full_sync_comments' ); |
|
1329 | ||
1330 | $comments = $synced_comments_event->args[0]; |
|
1331 | $this->assertEquals( 1, count( $comments ) ); |
|
1332 | $this->assertEquals( $keep_comment_id, $comments[0]->comment_ID ); |
|
1333 | } |
|
1334 | ||
1335 | function test_full_sync_doesnt_send_deleted_users() { |
|
1336 |