- Timestamp:
- 01/26/2017 03:15:07 PM (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/rest-api/rest-posts-controller.php
r39967 r39991 544 544 $this->assertCount( 2, $response->get_data() ); 545 545 // 'offset' takes priority over 'page' 546 $request->set_param( 'page', 3);546 $request->set_param( 'page', 2 ); 547 547 $response = $this->server->dispatch( $request ); 548 548 $this->assertCount( 2, $response->get_data() ); … … 772 772 $this->assertContains( '<' . $prev_link . '>; rel="prev"', $headers['Link'] ); 773 773 $this->assertFalse( stripos( $headers['Link'], 'rel="next"' ) ); 774 774 775 // Out of bounds 775 776 $request = new WP_REST_Request( 'GET', '/wp/v2/posts' ); … … 777 778 $response = $this->server->dispatch( $request ); 778 779 $headers = $response->get_headers(); 779 $this->assertEquals( 51, $headers['X-WP-Total'] ); 780 $this->assertEquals( 6, $headers['X-WP-TotalPages'] ); 781 $prev_link = add_query_arg( array( 782 'page' => 6, 783 ), rest_url( '/wp/v2/posts' ) ); 784 $this->assertContains( '<' . $prev_link . '>; rel="prev"', $headers['Link'] ); 785 $this->assertFalse( stripos( $headers['Link'], 'rel="next"' ) ); 780 $this->assertErrorResponse( 'rest_post_invalid_page_number', $response, 400 ); 786 781 787 782 // With query params.
Note: See TracChangeset
for help on using the changeset viewer.