Code Duplication    Length = 6-8 lines in 5 locations

tests/phpunit/tests/rest-api/rest-categories-controller.php 1 location

@@ 993-1000 (lines=8) @@
990
        $this->assertEquals(add_query_arg('categories', $term->term_id, rest_url('wp/v2/posts')), $links['https://api.w.org/post_type'][0]['href']);
991
    }
992
993
    protected function check_get_taxonomy_term_response( $response ) 
994
    {
995
996
        $this->assertEquals(200, $response->get_status());
997
998
        $data = $response->get_data();
999
        $category = get_term(1, 'category');
1000
        $this->check_taxonomy_term($category, $data, $response->get_links());
1001
    }
1002
}
1003

tests/phpunit/tests/rest-api/rest-post-types-controller.php 1 location

@@ 214-219 (lines=6) @@
211
        }
212
    }
213
214
    protected function check_post_type_object_response( $context, $response, $post_type = 'post' ) 
215
    {
216
        $this->assertEquals(200, $response->get_status());
217
        $data = $response->get_data();
218
        $obj = get_post_type_object($post_type);
219
        $this->check_post_type_obj($context, $obj, $data, $response->get_links());
220
    }
221
222
}

tests/phpunit/tests/rest-api/rest-tags-controller.php 1 location

@@ 1127-1134 (lines=8) @@
1124
        $this->assertEquals(add_query_arg('tags', $term->term_id, rest_url('wp/v2/posts')), $links['https://api.w.org/post_type'][0]['href']);
1125
    }
1126
1127
    protected function check_get_taxonomy_term_response( $response, $id ) 
1128
    {
1129
1130
        $this->assertEquals(200, $response->get_status());
1131
1132
        $data = $response->get_data();
1133
        $tag = get_term($id, 'post_tag');
1134
        $this->check_taxonomy_term($tag, $data, $response->get_links());
1135
    }
1136
}
1137

tests/phpunit/tests/rest-api/rest-taxonomies-controller.php 1 location

@@ 214-219 (lines=6) @@
211
        }
212
    }
213
214
    protected function check_taxonomy_object_response( $context, $response ) 
215
    {
216
        $this->assertEquals(200, $response->get_status());
217
        $data = $response->get_data();
218
        $category = get_taxonomy('category');
219
        $this->check_taxonomy_object($context, $category, $data, $response->get_links());
220
    }
221
222
    protected function check_taxonomies_for_type_response( $type, $response ) 

tests/phpunit/tests/rest-api/rest-users-controller.php 1 location

@@ 2305-2311 (lines=7) @@
2302
        $this->assertArrayNotHasKey('password', $data);
2303
    }
2304
2305
    protected function check_get_user_response( $response, $context = 'view' ) 
2306
    {
2307
        $this->assertEquals(200, $response->get_status());
2308
2309
        $data = $response->get_data();
2310
        $userdata = get_userdata($data['id']);
2311
        $this->check_user_data($userdata, $data, $context, $response->get_links());
2312
    }
2313
2314
    protected function check_add_edit_user_response( $response, $update = false )