| @@ 71-76 (lines=6) @@ | ||
| 68 | ); |
|
| 69 | } |
|
| 70 | ||
| 71 | public function test_get_items_unauthorized_context() |
|
| 72 | { |
|
| 73 | $request = new WP_REST_Request('GET', '/wp/v2/statuses'); |
|
| 74 | $request->set_param('context', 'edit'); |
|
| 75 | $response = $this->server->dispatch($request); |
|
| 76 | $this->assertErrorResponse('rest_cannot_view', $response, 401); |
|
| 77 | } |
|
| 78 | ||
| 79 | public function test_get_item() |
|
| @@ 896-901 (lines=6) @@ | ||
| 893 | $this->assertErrorResponse('rest_invalid_param', $response, 400); |
|
| 894 | } |
|
| 895 | ||
| 896 | public function test_get_items_invalid_context() |
|
| 897 | { |
|
| 898 | $request = new WP_REST_Request('GET', '/wp/v2/posts'); |
|
| 899 | $request->set_param('context', 'banana'); |
|
| 900 | $response = $this->server->dispatch($request); |
|
| 901 | $this->assertErrorResponse('rest_invalid_param', $response, 400); |
|
| 902 | } |
|
| 903 | ||
| 904 | public function test_get_items_invalid_date() |
|
| @@ 498-503 (lines=6) @@ | ||
| 495 | $this->assertFalse(stripos($headers['Link'], 'rel="next"')); |
|
| 496 | } |
|
| 497 | ||
| 498 | public function test_get_items_invalid_context() |
|
| 499 | { |
|
| 500 | $request = new WP_REST_Request('GET', '/wp/v2/tags'); |
|
| 501 | $request->set_param('context', 'banana'); |
|
| 502 | $response = $this->server->dispatch($request); |
|
| 503 | $this->assertErrorResponse('rest_invalid_param', $response, 400); |
|
| 504 | } |
|
| 505 | ||
| 506 | public function test_get_item() |
|
| @@ 64-69 (lines=6) @@ | ||
| 61 | $this->assertErrorResponse('rest_cannot_view', $response, 401); |
|
| 62 | } |
|
| 63 | ||
| 64 | public function test_get_taxonomies_for_type() |
|
| 65 | { |
|
| 66 | $request = new WP_REST_Request('GET', '/wp/v2/taxonomies'); |
|
| 67 | $request->set_param('type', 'post'); |
|
| 68 | $response = $this->server->dispatch($request); |
|
| 69 | $this->check_taxonomies_for_type_response('post', $response); |
|
| 70 | } |
|
| 71 | ||
| 72 | public function test_get_taxonomies_for_invalid_type() |
|
| @@ 425-430 (lines=6) @@ | ||
| 422 | $this->assertErrorResponse('rest_forbidden_orderby', $response, 401); |
|
| 423 | } |
|
| 424 | ||
| 425 | public function test_get_items_invalid_order() |
|
| 426 | { |
|
| 427 | $request = new WP_REST_Request('GET', '/wp/v2/users'); |
|
| 428 | $request->set_param('order', 'asc,id'); |
|
| 429 | $response = $this->server->dispatch($request); |
|
| 430 | $this->assertErrorResponse('rest_invalid_param', $response, 400); |
|
| 431 | } |
|
| 432 | ||
| 433 | public function test_get_items_invalid_orderby() |
|
| @@ 433-438 (lines=6) @@ | ||
| 430 | $this->assertErrorResponse('rest_invalid_param', $response, 400); |
|
| 431 | } |
|
| 432 | ||
| 433 | public function test_get_items_invalid_orderby() |
|
| 434 | { |
|
| 435 | $request = new WP_REST_Request('GET', '/wp/v2/users'); |
|
| 436 | $request->set_param('orderby', 'invalid'); |
|
| 437 | $response = $this->server->dispatch($request); |
|
| 438 | $this->assertErrorResponse('rest_invalid_param', $response, 400); |
|
| 439 | } |
|
| 440 | ||
| 441 | public function test_get_items_offset() |
|