From c04078ac9dfa1678148ccdc1b09056a58ddb3339 Mon Sep 17 00:00:00 2001 From: Sergey Biryukov Date: Mon, 4 Nov 2019 12:34:35 +0000 Subject: [PATCH] REST API: Set `orderby` parameter in tax relation unit tests added in [46646]. The default value of `date` caused a race condition resulting in random test failures. See #44326. git-svn-id: https://develop.svn.wordpress.org/trunk@46648 602fd350-edb4-49c9-b593-d223f7449a82 --- tests/phpunit/tests/rest-api/rest-posts-controller.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/tests/phpunit/tests/rest-api/rest-posts-controller.php b/tests/phpunit/tests/rest-api/rest-posts-controller.php index ed95e65a89..105e1565f2 100644 --- a/tests/phpunit/tests/rest-api/rest-posts-controller.php +++ b/tests/phpunit/tests/rest-api/rest-posts-controller.php @@ -978,6 +978,7 @@ class WP_Test_REST_Posts_Controller extends WP_Test_REST_Post_Type_Controller_Te $request->set_param( 'tax_relation', 'OR' ); $request->set_param( 'tags', array( $tag['term_id'] ) ); $request->set_param( 'categories', array( $category['term_id'] ) ); + $request->set_param( 'orderby', 'id' ); $response = rest_get_server()->dispatch( $request ); $data = $response->get_data(); @@ -1032,12 +1033,13 @@ class WP_Test_REST_Posts_Controller extends WP_Test_REST_Post_Type_Controller_Te $request->set_param( 'tags', array( $tag['term_id'] ) ); $request->set_param( 'categories_exclude', array( $category['term_id'] ) ); $request->set_param( 'tax_relation', 'OR' ); + $request->set_param( 'orderby', 'id' ); $response = rest_get_server()->dispatch( $request ); $data = $response->get_data(); $this->assertCount( 3, $data ); - $this->assertEquals( $id2, $data[0]['id'] ); - $this->assertEquals( $id4, $data[1]['id'] ); + $this->assertEquals( $id4, $data[0]['id'] ); + $this->assertEquals( $id2, $data[1]['id'] ); $this->assertEquals( $id1, $data[2]['id'] ); }