Code Duplication    Length = 19-19 lines in 2 locations

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

@@ 626-644 (lines=19) @@
623
		$this->assertErrorResponse( 'rest_term_invalid', $response, 400 );
624
	}
625
626
	public function test_update_item() {
627
		wp_set_current_user( $this->administrator );
628
		$orig_args = array(
629
			'name'        => 'Original Name',
630
			'description' => 'Original Description',
631
			'slug'        => 'original-slug',
632
			);
633
		$term = get_term_by( 'id', $this->factory->category->create( $orig_args ), 'category' );
634
		$request = new WP_REST_Request( 'POST', '/wp/v2/categories/' . $term->term_id );
635
		$request->set_param( 'name', 'New Name' );
636
		$request->set_param( 'description', 'New Description' );
637
		$request->set_param( 'slug', 'new-slug' );
638
		$response = $this->server->dispatch( $request );
639
		$this->assertEquals( 200, $response->get_status() );
640
		$data = $response->get_data();
641
		$this->assertEquals( 'New Name', $data['name'] );
642
		$this->assertEquals( 'New Description', $data['description'] );
643
		$this->assertEquals( 'new-slug', $data['slug'] );
644
	}
645
646
	public function test_update_item_invalid_taxonomy() {
647
		wp_set_current_user( $this->administrator );

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

@@ 490-508 (lines=19) @@
487
		$this->assertErrorResponse( 'rest_taxonomy_not_hierarchical', $response, 400 );
488
	}
489
490
	public function test_update_item() {
491
		wp_set_current_user( $this->administrator );
492
		$orig_args = array(
493
			'name'        => 'Original Name',
494
			'description' => 'Original Description',
495
			'slug'        => 'original-slug',
496
			);
497
		$term = get_term_by( 'id', $this->factory->tag->create( $orig_args ), 'post_tag' );
498
		$request = new WP_REST_Request( 'POST', '/wp/v2/tags/' . $term->term_id );
499
		$request->set_param( 'name', 'New Name' );
500
		$request->set_param( 'description', 'New Description' );
501
		$request->set_param( 'slug', 'new-slug' );
502
		$response = $this->server->dispatch( $request );
503
		$this->assertEquals( 200, $response->get_status() );
504
		$data = $response->get_data();
505
		$this->assertEquals( 'New Name', $data['name'] );
506
		$this->assertEquals( 'New Description', $data['description'] );
507
		$this->assertEquals( 'new-slug', $data['slug'] );
508
	}
509
510
	public function test_update_item_invalid_term() {
511
		wp_set_current_user( $this->administrator );