| @@ 166-174 (lines=9) @@ | ||
| 163 | $this->assertEquals( array(), $data ); |
|
| 164 | } |
|
| 165 | ||
| 166 | public function test_get_items_invalid_page() { |
|
| 167 | $request = new WP_REST_Request( 'GET', '/wp/v2/categories' ); |
|
| 168 | $request->set_param( 'page', 0 ); |
|
| 169 | $response = $this->server->dispatch( $request ); |
|
| 170 | $this->assertErrorResponse( 'rest_invalid_param', $response, 400 ); |
|
| 171 | $data = $response->get_data(); |
|
| 172 | $first_error = array_shift( $data['data']['params'] ); |
|
| 173 | $this->assertContains( 'page must be greater than 1 (inclusive)', $first_error ); |
|
| 174 | } |
|
| 175 | ||
| 176 | public function test_get_items_include_query() { |
|
| 177 | $id1 = $this->factory->category->create(); |
|
| @@ 1094-1105 (lines=12) @@ | ||
| 1091 | $this->assertErrorResponse( 'rest_invalid_param', $response, 400 ); |
|
| 1092 | } |
|
| 1093 | ||
| 1094 | public function test_create_post_with_quotes_in_title() { |
|
| 1095 | wp_set_current_user( $this->editor_id ); |
|
| 1096 | ||
| 1097 | $request = new WP_REST_Request( 'POST', '/wp/v2/posts' ); |
|
| 1098 | $params = $this->set_post_data( array( |
|
| 1099 | 'title' => "Rob O'Rourke's Diary", |
|
| 1100 | ) ); |
|
| 1101 | $request->set_body_params( $params ); |
|
| 1102 | $response = $this->server->dispatch( $request ); |
|
| 1103 | $new_data = $response->get_data(); |
|
| 1104 | $this->assertEquals( "Rob O'Rourke's Diary", $new_data['title']['raw'] ); |
|
| 1105 | } |
|
| 1106 | ||
| 1107 | public function test_create_post_with_categories() { |
|
| 1108 | wp_set_current_user( $this->editor_id ); |
|