Code Duplication    Length = 22-24 lines in 2 locations

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

@@ 37-58 (lines=22) @@
34
35
	}
36
37
	function test_sync_start_action_with_ranges() {
38
		$post = $this->factory->post->create();
39
		$this->factory->comment->create_post_comments( $post, 11 );
40
41
		$this->full_sync->start();
42
		$this->sender->do_full_sync();
43
44
		$start_event = $this->server_event_storage->get_most_recent_event( 'jetpack_full_sync_start' );
45
		$this->assertTrue( $start_event !== false );
46
47
		list( $config, $range ) = $start_event->args;
48
49
		$this->assertTrue( $config !== false );
50
51
		$this->assertTrue( isset( $range['posts']->max ) );
52
		$this->assertTrue( isset( $range['posts']->min ) );
53
		$this->assertTrue( isset( $range['posts']->count ) );
54
55
		$this->assertTrue( isset( $range['comments']->max ) );
56
		$this->assertTrue( isset( $range['comments']->min ) );
57
		$this->assertTrue( isset( $range['comments']->count ) );
58
	}
59
60
	function test_sync_health_in_sync_on_full_sync_end() {
61
		Health::update_status( Health::STATUS_OUT_OF_SYNC );

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

@@ 33-56 (lines=24) @@
30
		$this->sender->reset_data();
31
	}
32
33
	function test_enqueues_sync_start_action() {
34
		$post = $this->factory->post->create();
35
		$this->factory->comment->create_post_comments( $post, 11 );
36
37
		$this->full_sync->start();
38
		$this->sender->do_full_sync();
39
40
		$start_event = $this->server_event_storage->get_most_recent_event( 'jetpack_full_sync_start' );
41
		$this->assertTrue( $start_event !== false );
42
43
		$start_event = $this->server_event_storage->get_most_recent_event( 'jetpack_full_sync_start' );
44
45
		list( $config, $range ) = $start_event->args;
46
47
		$this->assertTrue( $config !== false );
48
49
		$this->assertTrue( isset( $range['posts']->max ) );
50
		$this->assertTrue( isset( $range['posts']->min ) );
51
		$this->assertTrue( isset( $range['posts']->count ) );
52
53
		$this->assertTrue( isset( $range['comments']->max ) );
54
		$this->assertTrue( isset( $range['comments']->min ) );
55
		$this->assertTrue( isset( $range['comments']->count ) );
56
	}
57
58
	function test_enqueues_sync_start_action_without_post_sends_empty_range() {
59
		$this->full_sync->start();