- Timestamp:
- 10/05/2017 12:36:43 AM (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/rest-api/rest-posts-controller.php
r40605 r41760 597 597 $this->assertEquals( 'abc', $data[1]['slug'] ); 598 598 $this->assertPostsOrderedBy( '{posts}.post_name DESC' ); 599 } 600 601 public function test_get_items_with_orderby_slugs() { 602 $slugs = array( 'burrito', 'taco', 'chalupa' ); 603 foreach ( $slugs as $slug ) { 604 $this->factory->post->create( array( 'post_title' => $slug, 'post_name' => $slug, 'post_status' => 'publish' ) ); 605 } 606 607 $request = new WP_REST_Request( 'GET', '/wp/v2/posts' ); 608 $request->set_param( 'orderby', 'include_slugs' ); 609 $request->set_param( 'slug', array( 'taco', 'chalupa', 'burrito' ) ); 610 611 $response = $this->server->dispatch( $request ); 612 $data = $response->get_data(); 613 614 $this->assertEquals( 'taco', $data[0]['slug'] ); 615 $this->assertEquals( 'chalupa', $data[1]['slug'] ); 616 $this->assertEquals( 'burrito', $data[2]['slug'] ); 599 617 } 600 618
Note: See TracChangeset
for help on using the changeset viewer.