Changeset 40056
- Timestamp:
- 02/12/2017 06:06:32 PM (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/query/results.php
r38398 r40056 367 367 368 368 /** 369 * @ticket 39055 370 */ 371 function test_query_orderby_post__in_with_no_order_specified() { 372 $post__in_array = array( self::$post_ids[2], self::$post_ids[0], self::$post_ids[1] ); 373 $expected_returned_array = array( self::$post_ids[2], self::$post_ids[0], self::$post_ids[1] ); 374 375 $q = new WP_Query( array( 376 'post__in' => $post__in_array, 377 'orderby' => 'post__in', 378 'fields' => 'ids' 379 ) ); 380 381 // Expect post ids in the same order as post__in array when no 'order' param is passed in 382 $this->assertSame( $expected_returned_array, $q->posts ); 383 } 384 385 /** 386 * @ticket 39055 387 */ 388 function test_query_orderby_post__in_with_order_asc() { 389 $post__in_array = array( self::$post_ids[2], self::$post_ids[0], self::$post_ids[1] ); 390 $expected_returned_array = array( self::$post_ids[2], self::$post_ids[0], self::$post_ids[1] ); 391 392 $q = new WP_Query( array( 393 'post__in' => $post__in_array, 394 'orderby' => 'post__in', 395 'order' => 'asc', 396 'fields' => 'ids' 397 ) ); 398 399 // Expect post ids in the same order as post__in array when order=asc is passed in 400 $this->assertSame( $expected_returned_array, $q->posts ); 401 } 402 403 /** 404 * @ticket 39055 405 */ 406 function test_query_orderby_post__in_with_order_desc() { 407 $post__in_array = array( self::$post_ids[1], self::$post_ids[2], self::$post_ids[0] ); 408 $expected_returned_array = array( self::$post_ids[1], self::$post_ids[2], self::$post_ids[0] ); 409 410 $q = new WP_Query( array( 411 'post__in' => $post__in_array, 412 'orderby' => 'post__in', 413 'order' => 'desc', 414 'fields' => 'ids' 415 ) ); 416 417 // Note that results are returned in the order specified in the post__in array 418 // Order=desc does not have an effect on the order of returned results 419 $this->assertSame( $expected_returned_array, $q->posts ); 420 } 421 422 /** 369 423 * @ticket 27252 370 424 * @ticket 31194
Note: See TracChangeset
for help on using the changeset viewer.