| @@ 332-343 (lines=12) @@ | ||
| 329 | /** |
|
| 330 | * Setting an item to "null" will essentially restore it to it's default value. |
|
| 331 | */ |
|
| 332 | public function test_update_item_with_null() |
|
| 333 | { |
|
| 334 | update_option('posts_per_page', 9); |
|
| 335 | ||
| 336 | wp_set_current_user(self::$administrator); |
|
| 337 | $request = new WP_REST_Request('PUT', '/wp/v2/settings'); |
|
| 338 | $request->set_param('posts_per_page', null); |
|
| 339 | $response = $this->server->dispatch($request); |
|
| 340 | $data = $response->get_data(); |
|
| 341 | ||
| 342 | $this->assertEquals(200, $response->get_status()); |
|
| 343 | $this->assertEquals(10, $data['posts_per_page']); |
|
| 344 | } |
|
| 345 | ||
| 346 | public function test_update_item_with_invalid_enum() |
|
| @@ 1894-1910 (lines=17) @@ | ||
| 1891 | $this->assertErrorResponse('rest_user_cannot_delete', $response, 403); |
|
| 1892 | } |
|
| 1893 | ||
| 1894 | public function test_delete_user_invalid_id() |
|
| 1895 | { |
|
| 1896 | $this->allow_user_to_manage_multisite(); |
|
| 1897 | wp_set_current_user(self::$user); |
|
| 1898 | ||
| 1899 | $request = new WP_REST_Request('DELETE', '/wp/v2/users/100'); |
|
| 1900 | $request['force'] = true; |
|
| 1901 | $request->set_param('reassign', false); |
|
| 1902 | $response = $this->server->dispatch($request); |
|
| 1903 | ||
| 1904 | // Not implemented in multisite. |
|
| 1905 | if (is_multisite() ) { |
|
| 1906 | $this->assertErrorResponse('rest_cannot_delete', $response, 501); |
|
| 1907 | return; |
|
| 1908 | } |
|
| 1909 | ||
| 1910 | $this->assertErrorResponse('rest_user_invalid_id', $response, 404); |
|
| 1911 | } |
|
| 1912 | ||
| 1913 | public function test_delete_user_reassign() |
|