diff --git tests/phpunit/tests/query/results.php tests/phpunit/tests/query/results.php
index 4593c14..0811944 100644
|
|
|
class Tests_Query_Results extends WP_UnitTestCase { |
| 583 | 583 | $result11 = $this->q->query( array_merge( $args, array( 'post_password' => 'burrito' ) ) ); |
| 584 | 584 | $this->assertEqualSets( array( $two, $three ), $result11 ); |
| 585 | 585 | } |
| | 586 | |
| | 587 | function test_query_meta_query_order() { |
| | 588 | $post1 = $this->factory->post->create( array( 'post_title' => 'meta-value-1', 'post_date' => '2007-01-01 00:00:00' ) ); |
| | 589 | $post2 = $this->factory->post->create( array( 'post_title' => 'meta-value-2', 'post_date' => '2007-01-01 00:00:00' ) ); |
| | 590 | $post3 = $this->factory->post->create( array( 'post_title' => 'meta-value-3', 'post_date' => '2007-01-01 00:00:00' ) ); |
| | 591 | |
| | 592 | add_post_meta($post1, 'order', 1); |
| | 593 | add_post_meta($post2, 'order', 2); |
| | 594 | add_post_meta($post3, 'order', 3); |
| | 595 | |
| | 596 | $args = array( |
| | 597 | 'post_type' => 'post', |
| | 598 | 'meta_key' => 'order', |
| | 599 | 'meta_value' => 1, |
| | 600 | 'meta_compare' => '>=', |
| | 601 | 'orderby' => 'meta_value' |
| | 602 | ); |
| | 603 | |
| | 604 | $args2 = array( |
| | 605 | 'post_type' => 'post', |
| | 606 | 'meta_key' => 'order', |
| | 607 | 'meta_value' => 1, |
| | 608 | 'meta_compare' => '>=', |
| | 609 | 'orderby' => 'meta_value', |
| | 610 | 'meta_query' => array( |
| | 611 | 'relation' => 'OR', |
| | 612 | array( |
| | 613 | 'key' => 'order', |
| | 614 | 'compare' => '>=', |
| | 615 | 'value' => 1 |
| | 616 | ) |
| | 617 | ) |
| | 618 | ); |
| | 619 | |
| | 620 | $posts = $this->q->query( $args ); |
| | 621 | $posts2 = $this->q->query( $args2 ); |
| | 622 | |
| | 623 | $this->assertEquals(wp_list_pluck( $posts, 'post_title' ), wp_list_pluck( $posts2, 'post_title' )); |
| | 624 | } |
| 586 | 625 | } |