Ticket #42781: 42781.diff
File 42781.diff, 1.5 KB (added by , 7 years ago) |
---|
-
src/wp-includes/rest-api/endpoints/class-wp-rest-terms-controller.php
419 419 if ( $term_id = $term->get_error_data( 'term_exists' ) ) { 420 420 $existing_term = get_term( $term_id, $this->taxonomy ); 421 421 $term->add_data( $existing_term->term_id, 'term_exists' ); 422 $term->add_data( array( 'status' => 40 9) );422 $term->add_data( array( 'status' => 400 ) ); 423 423 } 424 424 425 425 return $term; -
tests/phpunit/tests/rest-api/rest-categories-controller.php
693 693 694 694 /** 695 695 * @ticket 41370 696 * @ticket 42781 696 697 */ 697 698 public function test_create_item_term_already_exists() { 698 699 wp_set_current_user( self::$administrator ); … … 701 702 $response = $this->server->dispatch( $request ); 702 703 $this->assertEquals( 201, $response->get_status() ); 703 704 $response = $this->server->dispatch( $request ); 704 $this->assertEquals( 40 9, $response->get_status() );705 $this->assertEquals( 400, $response->get_status() ); 705 706 $data = $response->get_data(); 706 707 $this->assertEquals( 'term_exists', $data['code'] ); 707 708 }