| @@ 1083-1104 (lines=22) @@ | ||
| 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(); |
|
| 1085 | $existing_user_count = $user_counts['total_users']; |
|
| 1086 | ||
| 1087 | // previously, the behavior was to send false or throw errors - we |
|
| 1088 | // should actively detect false values and remove them |
|
| 1089 | $keep_user_id = $this->factory->user->create(); |
|
| 1090 | $delete_user_id = $this->factory->user->create(); |
|
| 1091 | ||
| 1092 | $this->full_sync->start(); |
|
| 1093 | ||
| 1094 | wp_delete_user( $delete_user_id ); |
|
| 1095 | ||
| 1096 | $this->sender->do_full_sync(); |
|
| 1097 | ||
| 1098 | $synced_users_event = $this->server_event_storage->get_most_recent_event( 'jetpack_full_sync_users' ); |
|
| 1099 | $users = $synced_users_event->args['users']; |
|
| 1100 | ||
| 1101 | $this->assertEquals( $existing_user_count + 1, count( $users ) ); |
|
| 1102 | // the last created user should be the fist sent out. |
|
| 1103 | $this->assertEquals( $keep_user_id, $users[0]->ID ); |
|
| 1104 | } |
|
| 1105 | ||
| 1106 | function test_full_sync_has_correct_sent_count_even_if_some_actions_unsent() { |
|
| 1107 | add_filter( 'jetpack_sync_before_send_jetpack_full_sync_users', array( $this, 'dont_sync_users' ) ); |
|
| @@ 1335-1357 (lines=23) @@ | ||
| 1332 | $this->assertEquals( $keep_comment_id, $comments[0]->comment_ID ); |
|
| 1333 | } |
|
| 1334 | ||
| 1335 | function test_full_sync_doesnt_send_deleted_users() { |
|
| 1336 | ||
| 1337 | $user_counts = count_users(); |
|
| 1338 | $existing_user_count = $user_counts['total_users']; |
|
| 1339 | ||
| 1340 | // previously, the behavior was to send false or throw errors - we |
|
| 1341 | // should actively detect false values and remove them |
|
| 1342 | $keep_user_id = $this->factory->user->create(); |
|
| 1343 | $delete_user_id = $this->factory->user->create(); |
|
| 1344 | ||
| 1345 | $this->full_sync->start(); |
|
| 1346 | ||
| 1347 | wp_delete_user( $delete_user_id ); |
|
| 1348 | ||
| 1349 | $this->sender->do_full_sync(); |
|
| 1350 | ||
| 1351 | $synced_users_event = $this->server_event_storage->get_most_recent_event( 'jetpack_full_sync_users' ); |
|
| 1352 | $users = $synced_users_event->args['users']; |
|
| 1353 | ||
| 1354 | $this->assertEquals( $existing_user_count+1, count( $users ) ); |
|
| 1355 | // the last created user should be the fist sent out. |
|
| 1356 | $this->assertEquals( $keep_user_id, $users[ 0 ]->ID ); |
|
| 1357 | } |
|
| 1358 | ||
| 1359 | function test_full_sync_has_correct_sent_count_even_if_some_actions_unsent() { |
|
| 1360 | // if actions get filtered out after dequeue, this can lead to the sent count |
|