Code Duplication    Length = 15-15 lines in 2 locations

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

@@ 437-451 (lines=15) @@
434
		$this->assertEquals( 'codeispoetry', $data['title']['raw'] );
435
	}
436
437
	public function test_create_item_with_files() {
438
		wp_set_current_user( $this->author_id );
439
		$request = new WP_REST_Request( 'POST', '/wp/v2/media' );
440
		$request->set_file_params( array(
441
			'file' => array(
442
				'file'     => file_get_contents( $this->test_file ),
443
				'name'     => 'canola.jpg',
444
				'size'     => filesize( $this->test_file ),
445
				'tmp_name' => $this->test_file,
446
			),
447
		) );
448
		$request->set_header( 'Content-MD5', md5_file( $this->test_file ) );
449
		$response = $this->server->dispatch( $request );
450
		$this->assertEquals( 201, $response->get_status() );
451
	}
452
453
	public function test_create_item_empty_body() {
454
		wp_set_current_user( $this->author_id );
@@ 488-502 (lines=15) @@
485
		$this->assertErrorResponse( 'rest_upload_hash_mismatch', $response, 412 );
486
	}
487
488
	public function test_create_item_with_files_bad_md5_header() {
489
		wp_set_current_user( $this->author_id );
490
		$request = new WP_REST_Request( 'POST', '/wp/v2/media' );
491
		$request->set_file_params( array(
492
			'file' => array(
493
				'file'     => file_get_contents( $this->test_file ),
494
				'name'     => 'canola.jpg',
495
				'size'     => filesize( $this->test_file ),
496
				'tmp_name' => $this->test_file,
497
			),
498
		) );
499
		$request->set_header( 'Content-MD5', 'abc123' );
500
		$response = $this->server->dispatch( $request );
501
		$this->assertErrorResponse( 'rest_upload_hash_mismatch', $response, 412 );
502
	}
503
504
	public function test_create_item_invalid_upload_files_capability() {
505
		wp_set_current_user( $this->contributor_id );