Code Duplication    Length = 15-15 lines in 4 locations

tests/phpunit/tests/comment/query.php 4 locations

@@ 100-114 (lines=15) @@
97
        $this->assertEqualSets(array( $c1 ), $found);
98
    }
99
100
    public function test_query_type_pingback() 
101
    {
102
        $c1 = self::factory()->comment->create(array( 'comment_post_ID' => self::$post_id, 'comment_approved' => '1' ));
103
        $c2 = self::factory()->comment->create(array( 'comment_post_ID' => self::$post_id, 'comment_approved' => '1', 'comment_type' => 'pingback' ));
104
        $c3 = self::factory()->comment->create(array( 'comment_post_ID' => self::$post_id, 'comment_approved' => '1', 'comment_type' => 'pingback' ));
105
        $c4 = self::factory()->comment->create(array( 'comment_post_ID' => self::$post_id, 'comment_approved' => '1', 'comment_type' => 'trackback' ));
106
107
        $q = new WP_Comment_Query();
108
        $found = $q->query(
109
            array(
110
            'type' => 'pingback',
111
            'fields' => 'ids',
112
            ) 
113
        );
114
115
        $this->assertEqualSets(array( $c2, $c3 ), $found);
116
117
    }
@@ 119-133 (lines=15) @@
116
117
    }
118
119
    public function test_query_type_trackback() 
120
    {
121
        $c1 = self::factory()->comment->create(array( 'comment_post_ID' => self::$post_id, 'comment_approved' => '1' ));
122
        $c2 = self::factory()->comment->create(array( 'comment_post_ID' => self::$post_id, 'comment_approved' => '1', 'comment_type' => 'trackback' ));
123
        $c3 = self::factory()->comment->create(array( 'comment_post_ID' => self::$post_id, 'comment_approved' => '1', 'comment_type' => 'trackback' ));
124
        $c4 = self::factory()->comment->create(array( 'comment_post_ID' => self::$post_id, 'comment_approved' => '1', 'comment_type' => 'pingback' ));
125
126
        $q = new WP_Comment_Query();
127
        $found = $q->query(
128
            array(
129
            'type' => 'trackback',
130
            'fields' => 'ids',
131
            ) 
132
        );
133
134
        $this->assertEqualSets(array( $c2, $c3 ), $found);
135
136
    }
@@ 384-398 (lines=15) @@
381
    /**
382
     * @ticket 12668
383
     */
384
    public function test_type_status_approved_array_comment_pings() 
385
    {
386
        $c1 = self::factory()->comment->create(array( 'comment_post_ID' => self::$post_id, 'comment_approved' => '1' ));
387
        $c2 = self::factory()->comment->create(array( 'comment_post_ID' => self::$post_id, 'comment_approved' => '1', 'comment_type' => 'pingback' ));
388
        $c3 = self::factory()->comment->create(array( 'comment_post_ID' => self::$post_id, 'comment_approved' => '1', 'comment_type' => 'pingback' ));
389
        $c4 = self::factory()->comment->create(array( 'comment_post_ID' => self::$post_id, 'comment_approved' => '0', 'comment_type' => 'pingback' ));
390
391
        $q = new WP_Comment_Query();
392
        $found = $q->query(
393
            array(
394
            'status' => 'approve',
395
            'type' => array( 'pings' ),
396
            'fields' => 'ids',
397
            ) 
398
        );
399
400
        $this->assertEqualSets(array( $c3, $c2 ), $found);
401
    }
@@ 446-460 (lines=15) @@
443
    /**
444
     * @ticket 12668
445
     */
446
    public function test_type_array_pings_approved() 
447
    {
448
        $c1 = self::factory()->comment->create(array( 'comment_post_ID' => self::$post_id, 'comment_approved' => '1' ));
449
        $c2 = self::factory()->comment->create(array( 'comment_post_ID' => self::$post_id, 'comment_approved' => '1', 'comment_type' => 'trackback' ));
450
        $c3 = self::factory()->comment->create(array( 'comment_post_ID' => self::$post_id, 'comment_approved' => '1', 'comment_type' => 'trackback' ));
451
        $c4 = self::factory()->comment->create(array( 'comment_post_ID' => self::$post_id, 'comment_approved' => '0', 'comment_type' => 'trackback' ));
452
453
        $q = new WP_Comment_Query();
454
        $found = $q->query(
455
            array(
456
            'status' => 'approve',
457
            'type' => array( 'pings' ),
458
            'fields' => 'ids',
459
            ) 
460
        );
461
462
        $this->assertEqualSets(array( $c3, $c2 ), $found);
463
    }