Code Duplication    Length = 24-24 lines in 2 locations

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

@@ 342-365 (lines=24) @@
339
		$this->assertErrorResponse( 'rest_forbidden_param', $response, 401 );
340
	}
341
342
	public function test_get_items_parent_arg() {
343
		$args = array(
344
			'comment_approved'  => 1,
345
			'comment_post_ID'   => $this->post_id,
346
		);
347
		$parent_id = $this->factory->comment->create( $args );
348
		$parent_id2 = $this->factory->comment->create( $args );
349
		$args['comment_parent'] = $parent_id;
350
		$this->factory->comment->create( $args );
351
		$args['comment_parent'] = $parent_id2;
352
		$this->factory->comment->create( $args );
353
		// All comments in the database
354
		$request = new WP_REST_Request( 'GET', '/wp/v2/comments' );
355
		$response = $this->server->dispatch( $request );
356
		$this->assertCount( 5, $response->get_data() );
357
		// Limit to the parent
358
		$request->set_param( 'parent', $parent_id );
359
		$response = $this->server->dispatch( $request );
360
		$this->assertCount( 1, $response->get_data() );
361
		// Limit to two parents
362
		$request->set_param( 'parent', array( $parent_id, $parent_id2 ) );
363
		$response = $this->server->dispatch( $request );
364
		$this->assertCount( 2, $response->get_data() );
365
	}
366
367
	public function test_get_items_parent_exclude_arg() {
368
		$args = array(
@@ 367-390 (lines=24) @@
364
		$this->assertCount( 2, $response->get_data() );
365
	}
366
367
	public function test_get_items_parent_exclude_arg() {
368
		$args = array(
369
			'comment_approved'  => 1,
370
			'comment_post_ID'   => $this->post_id,
371
		);
372
		$parent_id = $this->factory->comment->create( $args );
373
		$parent_id2 = $this->factory->comment->create( $args );
374
		$args['comment_parent'] = $parent_id;
375
		$this->factory->comment->create( $args );
376
		$args['comment_parent'] = $parent_id2;
377
		$this->factory->comment->create( $args );
378
		// All comments in the database
379
		$request = new WP_REST_Request( 'GET', '/wp/v2/comments' );
380
		$response = $this->server->dispatch( $request );
381
		$this->assertCount( 5, $response->get_data() );
382
		// Exclude this particular parent
383
		$request->set_param( 'parent_exclude', $parent_id );
384
		$response = $this->server->dispatch( $request );
385
		$this->assertCount( 4, $response->get_data() );
386
		// Exclude both comment parents
387
		$request->set_param( 'parent_exclude', array( $parent_id, $parent_id2 ) );
388
		$response = $this->server->dispatch( $request );
389
		$this->assertCount( 3, $response->get_data() );
390
	}
391
392
	public function test_get_items_search_query() {
393
		wp_set_current_user( $this->admin_id );