From 8b0f76c917fd7384f3998b069261536bc4b171db Mon Sep 17 00:00:00 2001 From: Pascal Birchler Date: Fri, 24 Mar 2017 18:49:07 +0000 Subject: [PATCH] List Tables: After [38703], [38706], and [40118], adjust the jQuery selector to make the selection of a range of checkboxes work again. Unprop afercia. Fixes #40056. Merges [40268] to the 4.7 branch. git-svn-id: https://develop.svn.wordpress.org/branches/4.7@40327 602fd350-edb4-49c9-b593-d223f7449a82 --- tests/phpunit/tests/query/results.php | 54 +++++++++++++++++++++++++++ 1 file changed, 54 insertions(+) diff --git a/tests/phpunit/tests/query/results.php b/tests/phpunit/tests/query/results.php index 58d603441c..53a23f2669 100644 --- a/tests/phpunit/tests/query/results.php +++ b/tests/phpunit/tests/query/results.php @@ -365,6 +365,60 @@ class Tests_Query_Results extends WP_UnitTestCase { ), wp_list_pluck( $posts, 'post_title' ) ); } + /** + * @ticket 39055 + */ + function test_query_orderby_post__in_with_no_order_specified() { + $post__in_array = array( self::$post_ids[2], self::$post_ids[0], self::$post_ids[1] ); + $expected_returned_array = array( self::$post_ids[2], self::$post_ids[0], self::$post_ids[1] ); + + $q = new WP_Query( array( + 'post__in' => $post__in_array, + 'orderby' => 'post__in', + 'fields' => 'ids' + ) ); + + // Expect post ids in the same order as post__in array when no 'order' param is passed in + $this->assertSame( $expected_returned_array, $q->posts ); + } + + /** + * @ticket 39055 + */ + function test_query_orderby_post__in_with_order_asc() { + $post__in_array = array( self::$post_ids[2], self::$post_ids[0], self::$post_ids[1] ); + $expected_returned_array = array( self::$post_ids[2], self::$post_ids[0], self::$post_ids[1] ); + + $q = new WP_Query( array( + 'post__in' => $post__in_array, + 'orderby' => 'post__in', + 'order' => 'asc', + 'fields' => 'ids' + ) ); + + // Expect post ids in the same order as post__in array when order=asc is passed in + $this->assertSame( $expected_returned_array, $q->posts ); + } + + /** + * @ticket 39055 + */ + function test_query_orderby_post__in_with_order_desc() { + $post__in_array = array( self::$post_ids[1], self::$post_ids[2], self::$post_ids[0] ); + $expected_returned_array = array( self::$post_ids[1], self::$post_ids[2], self::$post_ids[0] ); + + $q = new WP_Query( array( + 'post__in' => $post__in_array, + 'orderby' => 'post__in', + 'order' => 'desc', + 'fields' => 'ids' + ) ); + + // Note that results are returned in the order specified in the post__in array + // Order=desc does not have an effect on the order of returned results + $this->assertSame( $expected_returned_array, $q->posts ); + } + /** * @ticket 27252 * @ticket 31194