Code Duplication    Length = 29-29 lines in 2 locations

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

@@ 845-873 (lines=29) @@
842
		$this->assertTrue( isset( $this->full_sync_end_checksum['comments'] ) );
843
	}
844
845
	function test_full_sync_end_sends_range() {
846
		$this->create_dummy_data_and_reset_sync_status();
847
		add_action( 'jetpack_full_sync_end', array( $this, 'record_full_sync_end_checksum' ), 10, 2 );
848
849
		$this->full_sync->start();
850
		$this->sender->do_full_sync();
851
		$this->sender->do_full_sync();
852
		$this->sender->do_full_sync();
853
854
		$this->assertTrue( isset( $this->full_sync_end_range ) );
855
		$this->assertTrue( isset( $this->full_sync_end_range['posts']->max ) );
856
		$this->assertTrue( isset( $this->full_sync_end_range['posts']->min ) );
857
		$this->assertTrue( isset( $this->full_sync_end_range['posts']->count ) );
858
859
		$this->assertTrue( isset( $this->full_sync_end_range['comments']->max ) );
860
		$this->assertTrue( isset( $this->full_sync_end_range['comments']->min ) );
861
		$this->assertTrue( isset( $this->full_sync_end_range['comments']->count ) );
862
863
		$event = $this->server_event_storage->get_most_recent_event( 'jetpack_full_sync_end' );
864
865
		list( $checksum, $range ) = $event->args;
866
		$this->assertTrue( isset( $range['posts']->max ) );
867
		$this->assertTrue( isset( $range['posts']->min ) );
868
		$this->assertTrue( isset( $range['posts']->count ) );
869
870
		$this->assertTrue( isset( $range['comments']->max ) );
871
		$this->assertTrue( isset( $range['comments']->min ) );
872
		$this->assertTrue( isset( $range['comments']->count ) );
873
	}
874
875
	function create_dummy_data_and_reset_sync_status() {
876
		// lets create a bunch of posts

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

@@ 1034-1062 (lines=29) @@
1031
		$this->assertTrue( isset( $this->full_sync_end_checksum['comments'] ) );
1032
	}
1033
1034
	function test_full_sync_end_sends_range() {
1035
		$this->create_dummy_data_and_empty_the_queue();
1036
		add_action( 'jetpack_full_sync_end', array( $this, 'record_full_sync_end_checksum' ), 10, 2 );
1037
1038
		$this->full_sync->start();
1039
		$this->sender->do_full_sync();
1040
		$this->sender->do_full_sync();
1041
		$this->sender->do_full_sync();
1042
1043
		$this->assertTrue( isset( $this->full_sync_end_range ) );
1044
		$this->assertTrue( isset( $this->full_sync_end_range['posts']->max ) );
1045
		$this->assertTrue( isset( $this->full_sync_end_range['posts']->min ) );
1046
		$this->assertTrue( isset( $this->full_sync_end_range['posts']->count ) );
1047
1048
		$this->assertTrue( isset( $this->full_sync_end_range['comments']->max ) );
1049
		$this->assertTrue( isset( $this->full_sync_end_range['comments']->min ) );
1050
		$this->assertTrue( isset( $this->full_sync_end_range['comments']->count ) );
1051
1052
		$event = $this->server_event_storage->get_most_recent_event( 'jetpack_full_sync_end' );
1053
1054
		list( $checksum, $range ) = $event->args;
1055
		$this->assertTrue( isset( $range['posts']->max ) );
1056
		$this->assertTrue( isset( $range['posts']->min ) );
1057
		$this->assertTrue( isset( $range['posts']->count ) );
1058
1059
		$this->assertTrue( isset( $range['comments']->max ) );
1060
		$this->assertTrue( isset( $range['comments']->min ) );
1061
		$this->assertTrue( isset( $range['comments']->count ) );
1062
	}
1063
	function record_full_sync_end_checksum( $checksum, $range ) {
1064
		// $checksum  has been deprecated...
1065
		$this->full_sync_end_range = $range;