Code Duplication    Length = 6-8 lines in 5 locations

tests/test-rest-taxonomies-controller.php 1 location

@@ 166-171 (lines=6) @@
163
		}
164
	}
165
166
	protected function check_taxonomy_object_response( $context, $response ) {
167
		$this->assertEquals( 200, $response->get_status() );
168
		$data = $response->get_data();
169
		$category = get_taxonomy( 'category' );
170
		$this->check_taxonomy_object( $context, $category, $data, $response->get_links() );
171
	}
172
173
	protected function check_taxonomies_for_type_response( $type, $response ) {
174
		$this->assertEquals( 200, $response->get_status() );

tests/test-rest-categories-controller.php 1 location

@@ 869-876 (lines=8) @@
866
		$this->assertEquals( add_query_arg( 'categories', $term->term_id, rest_url( 'wp/v2/posts' ) ), $links['https://api.w.org/post_type'][0]['href'] );
867
	}
868
869
	protected function check_get_taxonomy_term_response( $response ) {
870
871
		$this->assertEquals( 200, $response->get_status() );
872
873
		$data = $response->get_data();
874
		$category = get_term( 1, 'category' );
875
		$this->check_taxonomy_term( $category, $data, $response->get_links() );
876
	}
877
}
878

tests/test-rest-post-types-controller.php 1 location

@@ 166-171 (lines=6) @@
163
		}
164
	}
165
166
	protected function check_post_type_object_response( $context, $response ) {
167
		$this->assertEquals( 200, $response->get_status() );
168
		$data = $response->get_data();
169
		$obj = get_post_type_object( 'post' );
170
		$this->check_post_type_obj( $context, $obj, $data, $response->get_links() );
171
	}
172
173
}
174

tests/test-rest-tags-controller.php 1 location

@@ 726-733 (lines=8) @@
723
		$this->assertEquals( add_query_arg( 'tags', $term->term_id, rest_url( 'wp/v2/posts' ) ), $links['https://api.w.org/post_type'][0]['href'] );
724
	}
725
726
	protected function check_get_taxonomy_term_response( $response, $id ) {
727
728
		$this->assertEquals( 200, $response->get_status() );
729
730
		$data = $response->get_data();
731
		$tag = get_term( $id, 'post_tag' );
732
		$this->check_taxonomy_term( $tag, $data, $response->get_links() );
733
	}
734
}
735

tests/test-rest-users-controller.php 1 location

@@ 1286-1292 (lines=7) @@
1283
		$this->assertArrayNotHasKey( 'password', $data );
1284
	}
1285
1286
	protected function check_get_user_response( $response, $context = 'view' ) {
1287
		$this->assertEquals( 200, $response->get_status() );
1288
1289
		$data = $response->get_data();
1290
		$userdata = get_userdata( $data['id'] );
1291
		$this->check_user_data( $userdata, $data, $context, $response->get_links() );
1292
	}
1293
1294
	protected function check_add_edit_user_response( $response, $update = false ) {
1295
		if ( $update ) {