| @@ 961-981 (lines=21) @@ | ||
| 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; |
|
| 963 | $non_existent_post = get_post( $non_existent_id ); |
|
| 964 | $non_existent_comment = get_comment( $non_existent_id ); |
|
| 965 | $non_existent_user = get_user_by( 'id', $non_existent_id ); |
|
| 966 | ||
| 967 | $this->assertTrue( empty( $non_existent_post ) ); |
|
| 968 | $this->assertTrue( empty( $non_existent_comment ) ); |
|
| 969 | $this->assertTrue( empty( $non_existent_user ) ); |
|
| 970 | ||
| 971 | $this->full_sync->start( array( |
|
| 972 | 'posts' => array( $non_existent_id ), |
|
| 973 | 'comments' => array( $non_existent_id ), |
|
| 974 | 'users' => array( $non_existent_id ) |
|
| 975 | ) ); |
|
| 976 | $this->sender->do_full_sync(); |
|
| 977 | ||
| 978 | $this->assertFalse( $this->server_event_storage->get_most_recent_event( 'jetpack_full_sync_posts' ) ); |
|
| 979 | $this->assertFalse( $this->server_event_storage->get_most_recent_event( 'jetpack_full_sync_comments' ) ); |
|
| 980 | $this->assertFalse( $this->server_event_storage->get_most_recent_event( 'jetpack_full_sync_users' ) ); |
|
| 981 | } |
|
| 982 | ||
| 983 | function test_full_sync_can_sync_individual_posts() { |
|
| 984 | $sync_post_id = $this->factory->post->create(); |
|
| @@ 1215-1231 (lines=17) @@ | ||
| 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; |
|
| 1217 | $non_existent_post = get_post( $non_existent_id ); |
|
| 1218 | $non_existent_comment = get_comment( $non_existent_id ); |
|
| 1219 | $non_existent_user = get_user_by( 'id', $non_existent_id ); |
|
| 1220 | ||
| 1221 | $this->assertTrue( empty( $non_existent_post ) ); |
|
| 1222 | $this->assertTrue( empty( $non_existent_comment ) ); |
|
| 1223 | $this->assertTrue( empty( $non_existent_user ) ); |
|
| 1224 | ||
| 1225 | $this->full_sync->start( array( 'posts' => array( $non_existent_id ), 'comments' => array( $non_existent_id ), 'users' => array( $non_existent_id ) ) ); |
|
| 1226 | $this->sender->do_full_sync(); |
|
| 1227 | ||
| 1228 | $this->assertFalse( $this->server_event_storage->get_most_recent_event( 'jetpack_full_sync_posts' ) ); |
|
| 1229 | $this->assertFalse( $this->server_event_storage->get_most_recent_event( 'jetpack_full_sync_comments' ) ); |
|
| 1230 | $this->assertFalse( $this->server_event_storage->get_most_recent_event( 'jetpack_full_sync_users' ) ); |
|
| 1231 | } |
|
| 1232 | ||
| 1233 | function test_full_sync_can_sync_individual_posts() { |
|
| 1234 | $sync_post_id = $this->factory->post->create(); |
|