Changeset 32713 for trunk/tests/phpunit/tests/user/query.php
- Timestamp:
- 06/09/2015 05:41:35 PM (11 years ago)
- File:
-
- 1 edited
-
trunk/tests/phpunit/tests/user/query.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/user/query.php
r32683 r32713 790 790 $this->assertEqualSets( $expected, $found ); 791 791 } 792 793 /** 794 * @ticket 32592 795 */ 796 public function test_top_level_or_meta_query_should_eliminate_duplicate_matches() { 797 $users = $this->factory->user->create_many( 3 ); 798 799 add_user_meta( $users[0], 'foo', 'bar' ); 800 add_user_meta( $users[1], 'foo', 'bar' ); 801 add_user_meta( $users[0], 'foo2', 'bar2' ); 802 803 $q = new WP_User_Query( array( 804 'meta_query' => array( 805 'relation' => 'OR', 806 array( 807 'key' => 'foo', 808 'value' => 'bar', 809 ), 810 array( 811 'key' => 'foo2', 812 'value' => 'bar2', 813 ), 814 ), 815 ) ); 816 817 $found = wp_list_pluck( $q->get_results(), 'ID' ); 818 $expected = array( $users[0], $users[1] ); 819 820 $this->assertEqualSets( $expected, $found ); 821 } 822 823 /** 824 * @ticket 32592 825 */ 826 public function test_nested_or_meta_query_should_eliminate_duplicate_matches() { 827 $users = $this->factory->user->create_many( 3 ); 828 829 add_user_meta( $users[0], 'foo', 'bar' ); 830 add_user_meta( $users[1], 'foo', 'bar' ); 831 add_user_meta( $users[0], 'foo2', 'bar2' ); 832 add_user_meta( $users[1], 'foo3', 'bar3' ); 833 834 $q = new WP_User_Query( array( 835 'meta_query' => array( 836 'relation' => 'AND', 837 array( 838 'key' => 'foo', 839 'value' => 'bar', 840 ), 841 array( 842 'relation' => 'OR', 843 array( 844 'key' => 'foo', 845 'value' => 'bar', 846 ), 847 array( 848 'key' => 'foo2', 849 'value' => 'bar2', 850 ), 851 ), 852 ), 853 ) ); 854 855 $found = wp_list_pluck( $q->get_results(), 'ID' ); 856 $expected = array( $users[0], $users[1] ); 857 858 $this->assertEqualSets( $expected, $found ); 859 } 792 860 }
Note: See TracChangeset
for help on using the changeset viewer.