WordPress.org

Make WordPress Core

Changeset 46670


Ignore:
Timestamp:
11/05/2019 10:39:37 PM (5 weeks ago)
Author:
johnbillion
Message:

REST API: Use explicit dates in a post ordering test to avoid indeterminate ordering.

See #48145

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/tests/rest-api/rest-posts-controller.php

    r46657 r46670  
    331331
    332332    public function test_get_items_include_query() {
    333         $id1 = $this->factory->post->create( array( 'post_status' => 'publish' ) );
    334         $id2 = $this->factory->post->create( array( 'post_status' => 'publish' ) );
    335 
    336         $request = new WP_REST_Request( 'GET', '/wp/v2/posts' );
    337 
    338         // Order defaults to 'desc'.
     333        $id1 = $this->factory->post->create( array(
     334            'post_status' => 'publish',
     335            'post_date'   => '2001-02-03 04:05:06',
     336        ) );
     337        $id2 = $this->factory->post->create( array(
     338            'post_status' => 'publish',
     339            'post_date'   => '2001-02-03 04:05:07',
     340        ) );
     341
     342        $request = new WP_REST_Request( 'GET', '/wp/v2/posts' );
     343
     344        // Order defaults to date descending.
    339345        $request->set_param( 'include', array( $id1, $id2 ) );
    340346        $response = rest_get_server()->dispatch( $request );
Note: See TracChangeset for help on using the changeset viewer.