@@ 195-216 (lines=22) @@ | ||
192 | $this->assertEquals( 11, count( $comments ) ); |
|
193 | } |
|
194 | ||
195 | function test_full_sync_sends_all_terms() { |
|
196 | $NUMBER_OF_TERMS_TO_CREATE = 11; |
|
197 | $this->server_replica_storage->reset(); |
|
198 | $this->sender->reset_data(); |
|
199 | for ( $i = 0; $i < $NUMBER_OF_TERMS_TO_CREATE; $i += 1 ) { |
|
200 | wp_insert_term( 'category ' . $i, 'category' ); |
|
201 | wp_insert_term( 'term ' . $i, 'post_tag' ); |
|
202 | } |
|
203 | ||
204 | // simulate emptying the server storage |
|
205 | $this->server_replica_storage->reset(); |
|
206 | $this->sender->reset_data(); |
|
207 | ||
208 | $this->full_sync->start(); |
|
209 | $this->sender->do_full_sync(); |
|
210 | ||
211 | $terms = $this->server_replica_storage->get_terms( 'post_tag' ); |
|
212 | $this->assertEquals( $NUMBER_OF_TERMS_TO_CREATE, count( $terms ) ); |
|
213 | ||
214 | $terms = $this->server_replica_storage->get_terms( 'category' ); |
|
215 | $this->assertEquals( $NUMBER_OF_TERMS_TO_CREATE + 1, count( $terms ) ); // 11 + 1 (for uncategorized term) |
|
216 | } |
|
217 | ||
218 | function test_full_sync_sends_all_terms_with_previous_interval_end() { |
|
219 | Settings::update_settings( array( 'max_full_sync_terms' => 1 ) ); |
@@ 221-242 (lines=22) @@ | ||
218 | $this->assertEquals( 11, count( $comments ) ); |
|
219 | } |
|
220 | ||
221 | function test_full_sync_sends_all_terms() { |
|
222 | $NUMBER_OF_TERMS_TO_CREATE = 11; |
|
223 | $this->server_replica_storage->reset(); |
|
224 | $this->sender->reset_data(); |
|
225 | for ( $i = 0; $i < $NUMBER_OF_TERMS_TO_CREATE; $i += 1 ) { |
|
226 | wp_insert_term( 'category ' . $i, 'category' ); |
|
227 | wp_insert_term( 'term ' . $i, 'post_tag' ); |
|
228 | } |
|
229 | ||
230 | // simulate emptying the server storage |
|
231 | $this->server_replica_storage->reset(); |
|
232 | $this->sender->reset_data(); |
|
233 | ||
234 | $this->full_sync->start(); |
|
235 | $this->sender->do_full_sync(); |
|
236 | ||
237 | $terms = $this->server_replica_storage->get_terms( 'post_tag' ); |
|
238 | $this->assertEquals( $NUMBER_OF_TERMS_TO_CREATE, count( $terms ) ); |
|
239 | ||
240 | $terms = $this->server_replica_storage->get_terms( 'category' ); |
|
241 | $this->assertEquals( $NUMBER_OF_TERMS_TO_CREATE + 1, count( $terms ) ); // 11 + 1 (for uncategorized term) |
|
242 | } |
|
243 | ||
244 | function test_full_sync_sends_all_terms_with_previous_interval_end() { |
|
245 | Settings::update_settings( array( 'max_queue_size_full_sync' => 1, 'max_enqueue_full_sync' => 10 ) ); |