Code Duplication    Length = 19-20 lines in 2 locations

tests/phpunit/tests/rest-api/rest-comments-controller.php 2 locations

@@ 1178-1197 (lines=20) @@
1175
        $this->assertErrorResponse('rest_comment_author_data_required', $response, 400);
1176
    }
1177
1178
    public function test_create_comment_author_email_too_short() 
1179
    {
1180
        wp_set_current_user(self::$admin_id);
1181
1182
        $params = array(
1183
         'post'         => self::$post_id,
1184
         'author_name'  => 'Homer J. Simpson',
1185
         'author_email' => 'a@b',
1186
         'content'      => 'in this house, we obey the laws of thermodynamics!',
1187
        );
1188
1189
        $request = new WP_REST_Request('POST', '/wp/v2/comments');
1190
        $request->add_header('content-type', 'application/json');
1191
        $request->set_body(wp_json_encode($params));
1192
        $response = $this->server->dispatch($request);
1193
1194
        $this->assertErrorResponse('rest_invalid_param', $response, 400);
1195
1196
        $data = $response->get_data();
1197
        $this->assertArrayHasKey('author_email', $data['data']['params']);
1198
    }
1199
1200
    public function test_create_item_invalid_no_content() 
@@ 2282-2300 (lines=19) @@
2279
        $this->assertEquals(200, $response->get_status());
2280
    }
2281
2282
    public function test_update_comment_author_email_too_short() 
2283
    {
2284
        wp_set_current_user(self::$admin_id);
2285
2286
        $params = array(
2287
         'post'         => self::$post_id,
2288
         'author_name'  => 'Homer J. Simpson',
2289
         'author_email' => 'a@b',
2290
         'content'      => 'in this house, we obey the laws of thermodynamics!',
2291
        );
2292
2293
        $request = new WP_REST_Request('PUT', sprintf('/wp/v2/comments/%d', self::$approved_id));
2294
        $request->add_header('content-type', 'application/json');
2295
        $request->set_body(wp_json_encode($params));
2296
        $response = $this->server->dispatch($request);
2297
2298
        $this->assertErrorResponse('rest_invalid_param', $response, 400);
2299
        $data = $response->get_data();
2300
        $this->assertArrayHasKey('author_email', $data['data']['params']);
2301
    }
2302
2303
    public function test_update_comment_invalid_type()