Code Duplication    Length = 17-19 lines in 3 locations

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

@@ 635-653 (lines=19) @@
632
	/**
633
	 * Tests that jetpack_sync_save_post events are not sent for blacklisted post_types
634
	 */
635
	function test_filters_out_blacklisted_post_types() {
636
		$args = array(
637
			'public' => true,
638
			'label'  => 'Snitch'
639
		);
640
		register_post_type( 'snitch', $args );
641
		$this->server_event_storage->reset();
642
643
		$post_id = $this->factory->post->create( array( 'post_type' => 'snitch' ) );
644
645
		$this->sender->do_sync();
646
647
		// Clean up.
648
		unregister_post_type( 'snitch' );
649
650
		$this->assertFalse( $this->server_replica_storage->get_post( $post_id ) );
651
		$sync_event = $this->server_event_storage->get_most_recent_event( 'jetpack_sync_save_post' );
652
		$this->assertFalse( $sync_event );
653
	}
654
655
	/**
656
	 * Tests that jetpack_published_post events are not sent for blacklisted post_types.
@@ 658-676 (lines=19) @@
655
	/**
656
	 * Tests that jetpack_published_post events are not sent for blacklisted post_types.
657
	 */
658
	public function test_filters_out_blacklisted_post_types_jetpack_published_post() {
659
		$args = array(
660
			'public' => true,
661
			'label'  => 'Snitch',
662
		);
663
		register_post_type( 'snitch', $args );
664
		$this->server_event_storage->reset();
665
666
		$post_id = $this->factory->post->create( array( 'post_type' => 'snitch' ) );
667
668
		$this->sender->do_sync();
669
670
		// Clean up.
671
		unregister_post_type( 'snitch' );
672
673
		$this->assertFalse( $this->server_replica_storage->get_post( $post_id ) );
674
		$sync_event = $this->server_event_storage->get_most_recent_event( 'jetpack_published_post' );
675
		$this->assertFalse( $sync_event );
676
	}
677
678
	/**
679
	 * Tests that deleted_post events are not sent for blacklisted post_types.

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

@@ 1282-1298 (lines=17) @@
1279
	/**
1280
	 * Verify get_check_sum is consistent for differently ordered arrays.
1281
	 */
1282
	public function test_sync_does_not_send_updates_if_array_order_is_only_change() {
1283
		$plugins = Functions::get_plugins();
1284
1285
		// Let's see if the original values get synced.
1286
		$this->sender->do_sync();
1287
		$plugins_synced = $this->server_replica_storage->get_callable( 'get_plugins' );
1288
1289
		$this->assertEquals( $plugins, $plugins_synced );
1290
1291
		add_filter( 'all_plugins', array( $this, 'reorder_array_keys' ), 100, 1 );
1292
		do_action( 'jetpack_sync_unlock_sync_callable' );
1293
		$this->server_event_storage->reset();
1294
		$this->sender->do_sync();
1295
1296
		$event = $this->server_event_storage->get_most_recent_event( 'jetpack_sync_callable' );
1297
		$this->assertFalse( $event );
1298
	}
1299
1300
	/**
1301
	 * Verify that all options are returned by get_objects_by_id