Code Duplication    Length = 20-20 lines in 2 locations

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

@@ 442-461 (lines=20) @@
439
		$this->assertEquals( 'foo', $this->server_replica_storage->get_constant( 'TEST_SYNC_ALL_CONSTANTS' ) );
440
	}
441
442
	function test_full_sync_constants_updates_checksums() {
443
		define( 'FOO_SYNC_ALL_CONSTANTS', 'foo' );
444
		$this->resetCallableAndConstantTimeouts();
445
		$helper                 = new Jetpack_Sync_Test_Helper();
446
		$helper->array_override = array( 'FOO_SYNC_ALL_CONSTANTS' );
447
		add_filter( 'jetpack_sync_constants_whitelist', array( $helper, 'filter_override_array' ) );
448
		$this->full_sync->start();
449
		$this->sender->do_full_sync();
450
451
		$this->assertEquals( 'foo', $this->server_replica_storage->get_constant( 'FOO_SYNC_ALL_CONSTANTS' ) );
452
453
		// reset the storage, check value, and do full sync - storage should be set!
454
		$this->server_replica_storage->reset();
455
		$this->server_event_storage->reset();
456
		// Do Sync shouldn't send anything becuase the checksums are up to date.
457
		$this->sender->do_sync();
458
		$this->assertEquals( null, $this->server_replica_storage->get_constant( 'FOO_SYNC_ALL_CONSTANTS' ) );
459
		$events = $this->server_event_storage->get_all_events( 'jetpack_sync_constant' );
460
		$this->assertTrue( empty( $events ) );
461
	}
462
463
	function test_full_sync_sends_all_functions() {
464
		Modules::get_module( "functions" )->set_callable_whitelist( array( 'jetpack_foo' => 'jetpack_foo_full_sync_callable' ) );

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

@@ 620-639 (lines=20) @@
617
		$this->assertEquals( 'foo', $this->server_replica_storage->get_constant( 'TEST_SYNC_ALL_CONSTANTS' ) );
618
	}
619
620
	function test_full_sync_constants_updates_checksums() {
621
		define( 'FOO_SYNC_ALL_CONSTANTS', 'foo' );
622
		$this->resetCallableAndConstantTimeouts();
623
		$helper = new Jetpack_Sync_Test_Helper();
624
		$helper->array_override = array( 'FOO_SYNC_ALL_CONSTANTS' );
625
		add_filter( 'jetpack_sync_constants_whitelist', array( $helper, 'filter_override_array' ) );
626
		$this->full_sync->start();
627
		$this->sender->do_full_sync();
628
629
		$this->assertEquals( 'foo', $this->server_replica_storage->get_constant( 'FOO_SYNC_ALL_CONSTANTS' ) );
630
631
		// reset the storage, check value, and do full sync - storage should be set!
632
		$this->server_replica_storage->reset();
633
		$this->server_event_storage->reset();
634
		// Do Sync shouldn't send anything becuase the checksums are up to date.
635
		$this->sender->do_sync();
636
		$this->assertEquals( null, $this->server_replica_storage->get_constant( 'FOO_SYNC_ALL_CONSTANTS' ) );
637
		$events = $this->server_event_storage->get_all_events( 'jetpack_sync_constant' );
638
		$this->assertTrue( empty( $events ) );
639
	}
640
641
	function test_full_sync_sends_all_functions() {
642
		Modules::get_module( "functions" )->set_callable_whitelist( array( 'jetpack_foo' => 'jetpack_foo_full_sync_callable' ) );