Code Duplication    Length = 25-25 lines in 2 locations

projects/plugins/jetpack/tests/php/sync/test_class.jetpack-sync-full-immediately.php 1 location

@@ 311-335 (lines=25) @@
308
		) );
309
	}
310
311
	function test_full_sync_sends_all_users() {
312
		$first_user_id = $this->factory->user->create();
313
		for ( $i = 0; $i < 9; $i += 1 ) {
314
			$user_id = $this->factory->user->create();
315
		}
316
317
		update_user_meta( $user_id, 'locale', 'en_GB' );
318
		// simulate emptying the server storage
319
		$this->server_replica_storage->reset();
320
		$this->sender->reset_data();
321
322
		$this->full_sync->start();
323
		$this->sender->do_full_sync();
324
325
		// 10 + 1 = 1 users gets always created.
326
		$this->assertEquals( 11, $this->server_replica_storage->user_count() );
327
		$user = $this->server_replica_storage->get_user( $user_id );
328
		$this->assertEquals( get_allowed_mime_types( $user_id ), $this->server_replica_storage->get_allowed_mime_types( $user_id ) );
329
330
		$this->assertEquals( get_user_locale( $user_id ), $this->server_replica_storage->get_user_locale( $user_id ) );
331
		$this->assertNull( $this->server_replica_storage->get_user_locale( $first_user_id ) );
332
333
		// Lets make sure that we don't send users passwords around.
334
		$this->assertFalse( isset( $user->data->user_pass ) );
335
	}
336
337
	function test_full_sync_sends_previous_interval_end_for_users() {
338
		for ( $i = 0; $i < 45; $i += 1 ) {

projects/plugins/jetpack/tests/php/sync/test_class.jetpack-sync-full.php 1 location

@@ 443-467 (lines=25) @@
440
		$this->full_sync->reset_data();
441
	}
442
443
	function test_full_sync_sends_all_users() {
444
		$first_user_id = $this->factory->user->create();
445
		for ( $i = 0; $i < 9; $i += 1 ) {
446
			$user_id = $this->factory->user->create();
447
		}
448
449
		update_user_meta( $user_id, 'locale', 'en_GB' );
450
		// simulate emptying the server storage
451
		$this->server_replica_storage->reset();
452
		$this->sender->reset_data();
453
454
		$this->full_sync->start();
455
		$this->sender->do_full_sync();
456
457
		// 10 + 1 = 1 users gets always created.
458
		$this->assertEquals( 11, $this->server_replica_storage->user_count() );
459
		$user = $this->server_replica_storage->get_user( $user_id );
460
		$this->assertEquals( get_allowed_mime_types( $user_id ), $this->server_replica_storage->get_allowed_mime_types( $user_id ) );
461
462
		$this->assertEquals( get_user_locale( $user_id ), $this->server_replica_storage->get_user_locale( $user_id ) );
463
		$this->assertNull( $this->server_replica_storage->get_user_locale( $first_user_id ) );
464
465
		// Lets make sure that we don't send users passwords around.
466
		$this->assertFalse( isset( $user->data->user_pass ) );
467
	}
468
469
	function test_full_sync_sends_previous_interval_end_for_users() {
470
		Settings::update_settings( array( 'max_queue_size_full_sync' => 1, 'max_enqueue_full_sync' => 10 ) );