diff --git a/tests/phpunit/tests/rest-api/rest-pages-controller.php b/tests/phpunit/tests/rest-api/rest-pages-controller.php
index dcc7c15..257c892 100644
|
a
|
b
|
class WP_Test_REST_Pages_Controller extends WP_Test_REST_Post_Type_Controller_Te |
| 349 | 349 | } |
| 350 | 350 | |
| 351 | 351 | public function test_get_item() { |
| 352 | | |
| | 352 | $post_id = $this->factory->post->create(); |
| | 353 | $request = new WP_REST_Request( 'GET', '/wp/v2/posts/' . $post_id ); |
| | 354 | $response = rest_get_server()->dispatch( $request ); |
| | 355 | $data = $response->get_data(); |
| | 356 | $this->assertEquals( 200, $response->get_status() ); |
| | 357 | $this->assertEquals( $data['id'], $post_id ); |
| 353 | 358 | } |
| 354 | 359 | |
| 355 | 360 | public function test_get_item_invalid_post_type() { |
| … |
… |
class WP_Test_REST_Pages_Controller extends WP_Test_REST_Post_Type_Controller_Te |
| 360 | 365 | } |
| 361 | 366 | |
| 362 | 367 | public function test_create_item() { |
| 363 | | |
| | 368 | wp_set_current_user( self::$editor_id ); |
| | 369 | $request = new WP_REST_Request( 'POST', '/wp/v2/pages' ); |
| | 370 | $params = $this->set_post_data( |
| | 371 | array( |
| | 372 | 'post-status' => 'publish', |
| | 373 | 'title' => 'Test Create Item' |
| | 374 | ) |
| | 375 | ); |
| | 376 | $request->set_body_params( $params ); |
| | 377 | $response = rest_get_server()->dispatch( $request ); |
| | 378 | $data = $response->get_data(); |
| | 379 | $this->assertEquals( 201, $response->get_status() ); |
| 364 | 380 | } |
| 365 | 381 | |
| 366 | 382 | public function test_create_item_with_template() { |