| @@ 1212-1225 (lines=14) @@ | ||
| 1209 | $this->assertEquals( $previous_interval_end, '~0' ); |
|
| 1210 | } |
|
| 1211 | ||
| 1212 | function test_disable_sending_full_sync() { |
|
| 1213 | $this->factory->post->create_many( 2 ); |
|
| 1214 | ||
| 1215 | $this->sender->reset_data(); |
|
| 1216 | $this->server_event_storage->reset(); |
|
| 1217 | ||
| 1218 | Settings::update_settings( array( 'full_sync_sender_enabled' => 0 ) ); |
|
| 1219 | ||
| 1220 | $this->full_sync->start(); |
|
| 1221 | $this->sender->do_full_sync(); |
|
| 1222 | ||
| 1223 | $start_event = $this->server_event_storage->get_most_recent_event( 'jetpack_full_sync_start' ); |
|
| 1224 | $this->assertTrue( ! $start_event ); |
|
| 1225 | } |
|
| 1226 | ||
| 1227 | function test_full_sync_send_max_chunks() { |
|
| 1228 | $this->factory->post->create_many( 10 ); |
|
| @@ 1247-1260 (lines=14) @@ | ||
| 1244 | $this->assertEquals( 5, $this->server_replica_storage->post_count() ); |
|
| 1245 | } |
|
| 1246 | ||
| 1247 | function test_enable_sending_full_sync() { |
|
| 1248 | $this->factory->post->create_many( 2 ); |
|
| 1249 | ||
| 1250 | $this->sender->reset_data(); |
|
| 1251 | $this->server_event_storage->reset(); |
|
| 1252 | ||
| 1253 | Settings::update_settings( array( 'full_sync_sender_enabled' => 1 ) ); |
|
| 1254 | ||
| 1255 | $this->full_sync->start(); |
|
| 1256 | $this->sender->do_full_sync(); |
|
| 1257 | ||
| 1258 | $start_event = $this->server_event_storage->get_most_recent_event( 'jetpack_full_sync_start' ); |
|
| 1259 | $this->assertTrue( ! empty( $start_event ) ); |
|
| 1260 | } |
|
| 1261 | ||
| 1262 | function _do_cron() { |
|
| 1263 | $_GET['check'] = wp_hash( '187425' ); |
|
| @@ 1677-1690 (lines=14) @@ | ||
| 1674 | $this->full_sync->reset_data(); |
|
| 1675 | } |
|
| 1676 | ||
| 1677 | function test_disable_sending_full_sync() { |
|
| 1678 | $this->factory->post->create_many( 2 ); |
|
| 1679 | ||
| 1680 | $this->sender->reset_data(); |
|
| 1681 | $this->server_event_storage->reset(); |
|
| 1682 | ||
| 1683 | Settings::update_settings( array( 'full_sync_sender_enabled' => 0 ) ); |
|
| 1684 | ||
| 1685 | $this->full_sync->start(); |
|
| 1686 | $this->sender->do_full_sync(); |
|
| 1687 | ||
| 1688 | $start_event = $this->server_event_storage->get_most_recent_event( 'jetpack_full_sync_start' ); |
|
| 1689 | $this->assertTrue( ! $start_event ); |
|
| 1690 | } |
|
| 1691 | ||
| 1692 | function test_enable_sending_full_sync() { |
|
| 1693 | $this->factory->post->create_many( 2 ); |
|
| @@ 1692-1705 (lines=14) @@ | ||
| 1689 | $this->assertTrue( ! $start_event ); |
|
| 1690 | } |
|
| 1691 | ||
| 1692 | function test_enable_sending_full_sync() { |
|
| 1693 | $this->factory->post->create_many( 2 ); |
|
| 1694 | ||
| 1695 | $this->sender->reset_data(); |
|
| 1696 | $this->server_event_storage->reset(); |
|
| 1697 | ||
| 1698 | Settings::update_settings( array( 'full_sync_sender_enabled' => 1 ) ); |
|
| 1699 | ||
| 1700 | $this->full_sync->start(); |
|
| 1701 | $this->sender->do_full_sync(); |
|
| 1702 | ||
| 1703 | $start_event = $this->server_event_storage->get_most_recent_event( 'jetpack_full_sync_start' ); |
|
| 1704 | $this->assertTrue( ! empty( $start_event ) ); |
|
| 1705 | } |
|
| 1706 | ||
| 1707 | function _do_cron() { |
|
| 1708 | $_GET['check'] = wp_hash( '187425' ); |
|