Code Duplication    Length = 28-28 lines in 3 locations

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

@@ 768-795 (lines=28) @@
765
		$updates_module->sync_last_event();
766
	}
767
768
	function test_full_sync_sends_theme_updates() {
769
770
		if ( is_multisite() ) {
771
			$this->markTestSkipped( 'Not compatible with multisite mode' );
772
		}
773
774
		wp_update_themes();
775
		$this->check_for_updates_to_sync();
776
		$this->sender->do_sync();
777
778
		// check that an update just finished
779
		$updates = $this->server_replica_storage->get_updates( 'themes' );
780
		$this->assertTrue( $updates->last_checked > strtotime( "-2 seconds" ) );
781
782
		// we need to do this because there's a check for elapsed time since last update
783
		// in the wp_update_themes() function
784
		$this->server_replica_storage->reset();
785
786
		$this->assertNull( $this->server_replica_storage->get_updates( 'themes' ) );
787
788
		// full sync should re-check for plugin updates
789
		$this->full_sync->start();
790
		$this->sender->do_full_sync();
791
792
		$updates = $this->server_replica_storage->get_updates( 'themes' );
793
		$this->assertNotNull( $updates );
794
		$this->assertTrue( $updates->last_checked > strtotime( "-10 seconds" ) );
795
	}
796
797
	function test_full_sync_start_sends_configuration() {
798
		$post_ids = $this->factory->post->create_many( 3 );

projects/plugins/jetpack/tests/php/sync/test_class.jetpack-sync-full.php 2 locations

@@ 932-959 (lines=28) @@
929
		$this->assertTrue( $updates->last_checked > strtotime( "-10 seconds" ), 'Last checked is less then 2 seconds: ' . $updates->last_checked . ' - lest then 10 sec:' . strtotime( "-10 seconds" ) );
930
	}
931
932
	function test_full_sync_sends_theme_updates() {
933
934
		if ( is_multisite() ) {
935
			$this->markTestSkipped( 'Not compatible with multisite mode' );
936
		}
937
938
		wp_update_themes();
939
		$this->check_for_updates_to_sync();
940
		$this->sender->do_sync();
941
942
		// check that an update just finished
943
		$updates = $this->server_replica_storage->get_updates( 'themes' );
944
		$this->assertTrue( $updates->last_checked > strtotime( "-2 seconds" ) );
945
946
		// we need to do this because there's a check for elapsed time since last update
947
		// in the wp_update_themes() function
948
		$this->server_replica_storage->reset();
949
950
		$this->assertNull( $this->server_replica_storage->get_updates( 'themes' ) );
951
952
		// full sync should re-check for plugin updates
953
		$this->full_sync->start();
954
		$this->sender->do_full_sync();
955
956
		$updates = $this->server_replica_storage->get_updates( 'themes' );
957
		$this->assertNotNull( $updates );
958
		$this->assertTrue( $updates->last_checked > strtotime( "-10 seconds" ) );
959
	}
960
961
	function test_full_sync_sends_core_updates() {
962
@@ 961-988 (lines=28) @@
958
		$this->assertTrue( $updates->last_checked > strtotime( "-10 seconds" ) );
959
	}
960
961
	function test_full_sync_sends_core_updates() {
962
963
		if ( is_multisite() ) {
964
			$this->markTestSkipped( 'Not compatible with multisite mode' );
965
		}
966
967
		_maybe_update_core();
968
969
		$this->sender->do_sync();
970
971
		// check that an update just finished
972
		$updates = $this->server_replica_storage->get_updates( 'core' );
973
		$this->assertTrue( $updates->last_checked > strtotime( "-10 seconds" ) );
974
975
		// we need to do this because there's a check for elapsed time since last update
976
		// in the wp_update_core() function
977
		$this->server_replica_storage->reset();
978
979
		$this->assertNull( $this->server_replica_storage->get_updates( 'core' ) );
980
981
		// full sync should re-check for plugin updates
982
		$this->full_sync->start();
983
		$this->sender->do_full_sync();
984
985
		$updates = $this->server_replica_storage->get_updates( 'core' );
986
		$this->assertNotNull( $updates );
987
		$this->assertTrue( $updates->last_checked > strtotime( "-10 seconds" ) );
988
	}
989
990
	function test_full_sync_start_sends_configuration() {
991
		$post_ids = $this->factory->post->create_many( 3 );