diff --git a/tests/phpunit/tests/rest-api/rest-posts-controller.php b/tests/phpunit/tests/rest-api/rest-posts-controller.php
index 26af946..0c043dd 100644
|
a
|
b
|
class WP_Test_REST_Posts_Controller extends WP_Test_REST_Post_Type_Controller_Te |
| 1608 | 1608 | $this->assertEquals( $params['excerpt'], $post->post_excerpt ); |
| 1609 | 1609 | } |
| 1610 | 1610 | |
| | 1611 | public function test_update_item_no_change() { |
| | 1612 | wp_set_current_user( self::$editor_id ); |
| | 1613 | $post = get_post( self::$post_id ); |
| | 1614 | |
| | 1615 | $request = new WP_REST_Request( 'PUT', sprintf( '/wp/v2/posts/%d', self::$post_id ) ); |
| | 1616 | $request->set_param( 'author', $post->post_author ); |
| | 1617 | |
| | 1618 | // Run twice to make sure that the update still succeeds even if no DB |
| | 1619 | // rows are updated. |
| | 1620 | $response = $this->server->dispatch( $request ); |
| | 1621 | $this->check_update_post_response( $response ); |
| | 1622 | |
| | 1623 | $response = $this->server->dispatch( $request ); |
| | 1624 | $this->check_update_post_response( $response ); |
| | 1625 | } |
| | 1626 | |
| 1611 | 1627 | public function test_rest_update_post() { |
| 1612 | 1628 | wp_set_current_user( self::$editor_id ); |
| 1613 | 1629 | |
diff --git a/tests/phpunit/tests/rest-api/rest-tags-controller.php b/tests/phpunit/tests/rest-api/rest-tags-controller.php
index 4c461d3..bdca9cb 100644
|
a
|
b
|
class WP_Test_REST_Tags_Controller extends WP_Test_REST_Controller_Testcase { |
| 554 | 554 | $this->assertEquals( 'new-slug', $data['slug'] ); |
| 555 | 555 | } |
| 556 | 556 | |
| | 557 | public function test_update_item_no_change() { |
| | 558 | wp_set_current_user( self::$administrator ); |
| | 559 | $term = get_term_by( 'id', $this->factory->tag->create(), 'post_tag' ); |
| | 560 | |
| | 561 | $request = new WP_REST_Request( 'PUT', '/wp/v2/tags/' . $term->term_id ); |
| | 562 | |
| | 563 | $response = $this->server->dispatch( $request ); |
| | 564 | $this->assertEquals( 200, $response->get_status() ); |
| | 565 | $request->set_param( 'slug', $term->slug ); |
| | 566 | |
| | 567 | // Run twice to make sure that the update still succeeds even if no DB |
| | 568 | // rows are updated. |
| | 569 | $response = $this->server->dispatch( $request ); |
| | 570 | $this->assertEquals( 200, $response->get_status() ); |
| | 571 | |
| | 572 | $response = $this->server->dispatch( $request ); |
| | 573 | $this->assertEquals( 200, $response->get_status() ); |
| | 574 | } |
| | 575 | |
| 557 | 576 | public function test_update_item_invalid_term() { |
| 558 | 577 | wp_set_current_user( self::$administrator ); |
| 559 | 578 | $request = new WP_REST_Request( 'POST', '/wp/v2/tags/' . REST_TESTS_IMPOSSIBLY_HIGH_NUMBER ); |
diff --git a/tests/phpunit/tests/rest-api/rest-users-controller.php b/tests/phpunit/tests/rest-api/rest-users-controller.php
index 8da864f..62da922 100644
|
a
|
b
|
class WP_Test_REST_Users_Controller extends WP_Test_REST_Controller_Testcase { |
| 1087 | 1087 | $this->assertEquals( $pw_before, $user->user_pass ); |
| 1088 | 1088 | } |
| 1089 | 1089 | |
| | 1090 | public function test_update_item_no_change() { |
| | 1091 | $this->allow_user_to_manage_multisite(); |
| | 1092 | wp_set_current_user( self::$user ); |
| | 1093 | $user = get_userdata( self::$editor ); |
| | 1094 | |
| | 1095 | $request = new WP_REST_Request( 'PUT', sprintf( '/wp/v2/users/%d', self::$editor ) ); |
| | 1096 | $request->set_param( 'slug', $user->user_nicename ); |
| | 1097 | |
| | 1098 | // Run twice to make sure that the update still succeeds even if no DB |
| | 1099 | // rows are updated. |
| | 1100 | $response = $this->server->dispatch( $request ); |
| | 1101 | $this->assertEquals( 200, $response->get_status() ); |
| | 1102 | |
| | 1103 | $response = $this->server->dispatch( $request ); |
| | 1104 | $this->assertEquals( 200, $response->get_status() ); |
| | 1105 | } |
| | 1106 | |
| 1090 | 1107 | public function test_update_item_existing_email() { |
| 1091 | 1108 | $user1 = $this->factory->user->create( array( 'user_login' => 'test_json_user', 'user_email' => 'testjson@example.com' ) ); |
| 1092 | 1109 | $user2 = $this->factory->user->create( array( 'user_login' => 'test_json_user2', 'user_email' => 'testjson2@example.com' ) ); |