- Timestamp:
- 04/23/2017 10:19:29 PM (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/rest-api/rest-posts-controller.php
r40350 r40545 568 568 $response = $this->server->dispatch( $request ); 569 569 $this->assertErrorResponse( 'rest_no_search_term_defined', $response, 400 ); 570 }571 572 public function test_get_items_ignore_sticky_posts_by_default() {573 $this->markTestSkipped( 'Broken, see https://github.com/WP-API/WP-API/issues/2210' );574 $post_id1 = $this->factory->post->create( array( 'post_status' => 'publish', 'post_date' => '2015-01-01 12:00:00', 'post_date_gmt' => '2015-01-01 12:00:00' ) );575 $post_id2 = $this->factory->post->create( array( 'post_status' => 'publish', 'post_date' => '2015-01-02 12:00:00', 'post_date_gmt' => '2015-01-02 12:00:00' ) );576 $post_id3 = $this->factory->post->create( array( 'post_status' => 'publish', 'post_date' => '2015-01-03 12:00:00', 'post_date_gmt' => '2015-01-03 12:00:00' ) );577 stick_post( $post_id2 );578 579 // No stickies by default580 $request = new WP_REST_Request( 'GET', '/wp/v2/posts' );581 $response = $this->server->dispatch( $request );582 $data = $response->get_data();583 $this->assertEquals( array( self::$post_id, $post_id3, $post_id2, $post_id1 ), wp_list_pluck( $data, 'id' ) );584 585 // Permit stickies586 $request = new WP_REST_Request( 'GET', '/wp/v2/posts' );587 $request->set_param( 'ignore_sticky_posts', false );588 $response = $this->server->dispatch( $request );589 $data = $response->get_data();590 $this->assertEquals( array( $post_id2, self::$post_id, $post_id3, $post_id1 ), wp_list_pluck( $data, 'id' ) );591 570 } 592 571
Note: See TracChangeset
for help on using the changeset viewer.