- Timestamp:
- 01/26/2021 06:26:13 PM (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/rest-api/rest-pages-controller.php
r49603 r50024 77 77 'include', 78 78 'menu_order', 79 'modified_after', 80 'modified_before', 79 81 'offset', 80 82 'order', … … 356 358 $request->set_param( 'after', '2016-01-15T00:00:00Z' ); 357 359 $request->set_param( 'before', '2016-01-17T00:00:00Z' ); 360 $response = rest_get_server()->dispatch( $request ); 361 $data = $response->get_data(); 362 $this->assertCount( 1, $data ); 363 $this->assertSame( $post2, $data[0]['id'] ); 364 } 365 366 /** 367 * @ticket 50617 368 */ 369 public function test_get_items_invalid_modified_date() { 370 $request = new WP_REST_Request( 'GET', '/wp/v2/pages' ); 371 $request->set_param( 'modified_after', rand_str() ); 372 $request->set_param( 'modified_before', rand_str() ); 373 $response = rest_get_server()->dispatch( $request ); 374 $this->assertErrorResponse( 'rest_invalid_param', $response, 400 ); 375 } 376 377 /** 378 * @ticket 50617 379 */ 380 public function test_get_items_valid_modified_date() { 381 $post1 = $this->factory->post->create( 382 array( 383 'post_date' => '2016-01-01 00:00:00', 384 'post_type' => 'page', 385 ) 386 ); 387 $post2 = $this->factory->post->create( 388 array( 389 'post_date' => '2016-01-02 00:00:00', 390 'post_type' => 'page', 391 ) 392 ); 393 $post3 = $this->factory->post->create( 394 array( 395 'post_date' => '2016-01-03 00:00:00', 396 'post_type' => 'page', 397 ) 398 ); 399 $this->update_post_modified( $post1, '2016-01-15 00:00:00' ); 400 $this->update_post_modified( $post2, '2016-01-16 00:00:00' ); 401 $this->update_post_modified( $post3, '2016-01-17 00:00:00' ); 402 $request = new WP_REST_Request( 'GET', '/wp/v2/pages' ); 403 $request->set_param( 'modified_after', '2016-01-15T00:00:00Z' ); 404 $request->set_param( 'modified_before', '2016-01-17T00:00:00Z' ); 358 405 $response = rest_get_server()->dispatch( $request ); 359 406 $data = $response->get_data();
Note: See TracChangeset
for help on using the changeset viewer.