Code Duplication    Length = 17-19 lines in 3 locations

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

@@ 618-636 (lines=19) @@
615
	/**
616
	 * Tests that jetpack_sync_save_post events are not sent for blacklisted post_types
617
	 */
618
	function test_filters_out_blacklisted_post_types() {
619
		$args = array(
620
			'public' => true,
621
			'label'  => 'Snitch'
622
		);
623
		register_post_type( 'snitch', $args );
624
		$this->server_event_storage->reset();
625
626
		$post_id = $this->factory->post->create( array( 'post_type' => 'snitch' ) );
627
628
		$this->sender->do_sync();
629
630
		// Clean up.
631
		unregister_post_type( 'snitch' );
632
633
		$this->assertFalse( $this->server_replica_storage->get_post( $post_id ) );
634
		$sync_event = $this->server_event_storage->get_most_recent_event( 'jetpack_sync_save_post' );
635
		$this->assertFalse( $sync_event );
636
	}
637
638
	/**
639
	 * Tests that jetpack_published_post events are not sent for blacklisted post_types.
@@ 641-659 (lines=19) @@
638
	/**
639
	 * Tests that jetpack_published_post events are not sent for blacklisted post_types.
640
	 */
641
	public function test_filters_out_blacklisted_post_types_jetpack_published_post() {
642
		$args = array(
643
			'public' => true,
644
			'label'  => 'Snitch',
645
		);
646
		register_post_type( 'snitch', $args );
647
		$this->server_event_storage->reset();
648
649
		$post_id = $this->factory->post->create( array( 'post_type' => 'snitch' ) );
650
651
		$this->sender->do_sync();
652
653
		// Clean up.
654
		unregister_post_type( 'snitch' );
655
656
		$this->assertFalse( $this->server_replica_storage->get_post( $post_id ) );
657
		$sync_event = $this->server_event_storage->get_most_recent_event( 'jetpack_published_post' );
658
		$this->assertFalse( $sync_event );
659
	}
660
661
	/**
662
	 * 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

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