Code Duplication    Length = 15-16 lines in 3 locations

tests/test-rest-comments-controller.php 3 locations

@@ 1227-1241 (lines=15) @@
1224
		$this->assertArrayHasKey( 'children', $response->get_links() );
1225
	}
1226
1227
	public function test_delete_item() {
1228
		wp_set_current_user( $this->admin_id );
1229
1230
		$comment_id = $this->factory->comment->create( array(
1231
			'comment_approved' => 1,
1232
			'comment_post_ID'  => $this->post_id,
1233
			'user_id'          => $this->subscriber_id,
1234
		));
1235
		$request = new WP_REST_Request( 'DELETE', sprintf( '/wp/v2/comments/%d', $comment_id ) );
1236
1237
		$response = $this->server->dispatch( $request );
1238
		$this->assertEquals( 200, $response->get_status() );
1239
		$data = $response->get_data();
1240
		$this->assertEquals( $this->post_id, $data['post'] );
1241
	}
1242
1243
	public function test_delete_item_skip_trash() {
1244
		wp_set_current_user( $this->admin_id );
@@ 1243-1258 (lines=16) @@
1240
		$this->assertEquals( $this->post_id, $data['post'] );
1241
	}
1242
1243
	public function test_delete_item_skip_trash() {
1244
		wp_set_current_user( $this->admin_id );
1245
1246
		$comment_id = $this->factory->comment->create( array(
1247
			'comment_approved' => 1,
1248
			'comment_post_ID'  => $this->post_id,
1249
			'user_id'          => $this->subscriber_id,
1250
		));
1251
		$request = new WP_REST_Request( 'DELETE', sprintf( '/wp/v2/comments/%d', $comment_id ) );
1252
		$request['force'] = true;
1253
1254
		$response = $this->server->dispatch( $request );
1255
		$this->assertEquals( 200, $response->get_status() );
1256
		$data = $response->get_data();
1257
		$this->assertEquals( $this->post_id, $data['post'] );
1258
	}
1259
1260
	public function test_delete_item_already_trashed() {
1261
		wp_set_current_user( $this->admin_id );
@@ 1260-1274 (lines=15) @@
1257
		$this->assertEquals( $this->post_id, $data['post'] );
1258
	}
1259
1260
	public function test_delete_item_already_trashed() {
1261
		wp_set_current_user( $this->admin_id );
1262
1263
		$comment_id = $this->factory->comment->create( array(
1264
			'comment_approved' => 1,
1265
			'comment_post_ID'  => $this->post_id,
1266
			'user_id'          => $this->subscriber_id,
1267
		));
1268
		$request = new WP_REST_Request( 'DELETE', sprintf( '/wp/v2/comments/%d', $comment_id ) );
1269
		$response = $this->server->dispatch( $request );
1270
		$this->assertEquals( 200, $response->get_status() );
1271
		$data = $response->get_data();
1272
		$response = $this->server->dispatch( $request );
1273
		$this->assertErrorResponse( 'rest_already_trashed', $response, 410 );
1274
	}
1275
1276
	public function test_delete_comment_invalid_id() {
1277
		wp_set_current_user( $this->admin_id );