Code Duplication    Length = 15-16 lines in 3 locations

projects/plugins/jetpack/tests/php/general/test_class.jetpack.php 3 locations

@@ 648-662 (lines=15) @@
645
	 * @author tyxla
646
	 * @covers Jetpack::get_assumed_site_creation_date()
647
	 */
648
	function test_get_assumed_site_creation_date_user_earliest() {
649
		$user_id = $this->factory->user->create( array(
650
			'role'            => 'administrator',
651
			'user_registered' => '1990-01-01 00:00:00',
652
		) );
653
		$post_id = $this->factory->post->create( array(
654
			'post_date' => '1995-01-01 00:00:00',
655
		) );
656
657
		$jetpack = new MockJetpack();
658
		$this->assertEquals( '1990-01-01 00:00:00', $jetpack::connection()->get_assumed_site_creation_date() );
659
660
		wp_delete_user( $user_id );
661
		wp_delete_post( $post_id, true );
662
	}
663
664
	/**
665
	 * @author tyxla
@@ 668-682 (lines=15) @@
665
	 * @author tyxla
666
	 * @covers Jetpack::get_assumed_site_creation_date()
667
	 */
668
	function test_get_assumed_site_creation_date_post_earliest() {
669
		$user_id = $this->factory->user->create( array(
670
			'role'            => 'administrator',
671
			'user_registered' => '1994-01-01 00:00:00',
672
		) );
673
		$post_id = $this->factory->post->create( array(
674
			'post_date' => '1991-01-01 00:00:00',
675
		) );
676
677
		$jetpack = new MockJetpack();
678
		$this->assertEquals( '1991-01-01 00:00:00', $jetpack::connection()->get_assumed_site_creation_date() );
679
680
		wp_delete_user( $user_id );
681
		wp_delete_post( $post_id, true );
682
	}
683
684
	/**
685
	 * @author tyxla
@@ 688-703 (lines=16) @@
685
	 * @author tyxla
686
	 * @covers Jetpack::get_assumed_site_creation_date()
687
	 */
688
	function test_get_assumed_site_creation_date_only_admins() {
689
		$admin_id = $this->factory->user->create( array(
690
			'role'            => 'administrator',
691
			'user_registered' => '1994-01-01 00:00:00',
692
		) );
693
		$editor_id = $this->factory->user->create( array(
694
			'role'            => 'editor',
695
			'user_registered' => '1992-01-01 00:00:00',
696
		) );
697
698
		$jetpack = new MockJetpack();
699
		$this->assertEquals( '1994-01-01 00:00:00', $jetpack::connection()->get_assumed_site_creation_date() );
700
701
		wp_delete_user( $admin_id );
702
		wp_delete_user( $editor_id );
703
	}
704
705
	/**
706
	 * @author ebinnion