| @@ 102-118 (lines=17) @@ | ||
| 99 | $this->assertTrue( $cancelled_event !== false ); |
|
| 100 | } |
|
| 101 | ||
| 102 | function test_full_sync_lock_has_one_hour_timeout() { |
|
| 103 | $this->started_sync_count = 0; |
|
| 104 | ||
| 105 | add_action( 'jetpack_full_sync_start', array( $this, 'count_full_sync_start' ) ); |
|
| 106 | ||
| 107 | $this->full_sync->start(); |
|
| 108 | ||
| 109 | $this->assertEquals( 1, $this->started_sync_count ); |
|
| 110 | ||
| 111 | // fake the last sync being over an hour ago |
|
| 112 | $prefix = Full_Sync::STATUS_OPTION_PREFIX; |
|
| 113 | update_option( "{$prefix}_started", time() - 3700 ); |
|
| 114 | ||
| 115 | $this->full_sync->start(); |
|
| 116 | ||
| 117 | $this->assertEquals( 2, $this->started_sync_count ); |
|
| 118 | } |
|
| 119 | ||
| 120 | function count_full_sync_start() { |
|
| 121 | $this->started_sync_count += 1; |
|
| @@ 128-144 (lines=17) @@ | ||
| 125 | $this->assertTrue( $cancelled_event !== false ); |
|
| 126 | } |
|
| 127 | ||
| 128 | function test_full_sync_lock_has_one_hour_timeout() { |
|
| 129 | $this->started_sync_count = 0; |
|
| 130 | ||
| 131 | add_action( 'jetpack_full_sync_start', array( $this, 'count_full_sync_start' ) ); |
|
| 132 | ||
| 133 | $this->full_sync->start(); |
|
| 134 | ||
| 135 | $this->assertEquals( 1, $this->started_sync_count ); |
|
| 136 | ||
| 137 | // fake the last sync being over an hour ago |
|
| 138 | $prefix = Full_Sync::STATUS_OPTION_PREFIX; |
|
| 139 | update_option( "{$prefix}_started", time() - 3700 ); |
|
| 140 | ||
| 141 | $this->full_sync->start(); |
|
| 142 | ||
| 143 | $this->assertEquals( 2, $this->started_sync_count ); |
|
| 144 | } |
|
| 145 | ||
| 146 | function count_full_sync_start() { |
|
| 147 | $this->started_sync_count += 1; |
|