| @@ 891-910 (lines=20) @@ | ||
| 888 | /** |
|
| 889 | * @ticket 32081 |
|
| 890 | */ |
|
| 891 | public function test_meta_query_should_work_with_comment__in() |
|
| 892 | { |
|
| 893 | $comments = self::factory()->comment->create_many(3); |
|
| 894 | ||
| 895 | add_comment_meta($comments[0], 'foo', 'jjj'); |
|
| 896 | add_comment_meta($comments[1], 'foo', 'zzz'); |
|
| 897 | add_comment_meta($comments[2], 'foo', 'jjj'); |
|
| 898 | ||
| 899 | $q = new WP_Comment_Query( |
|
| 900 | array( |
|
| 901 | 'comment__in' => array( $comments[1], $comments[2] ), |
|
| 902 | 'meta_query' => array( |
|
| 903 | array( |
|
| 904 | 'key' => 'foo', |
|
| 905 | 'value' => 'jjj', |
|
| 906 | ), |
|
| 907 | ), |
|
| 908 | 'fields' => 'ids', |
|
| 909 | ) |
|
| 910 | ); |
|
| 911 | ||
| 912 | $this->assertEquals(array( $comments[2] ), $q->get_comments()); |
|
| 913 | } |
|
| @@ 918-937 (lines=20) @@ | ||
| 915 | /** |
|
| 916 | * @ticket 32081 |
|
| 917 | */ |
|
| 918 | public function test_meta_query_should_work_with_comment__not_in() |
|
| 919 | { |
|
| 920 | $comments = self::factory()->comment->create_many(3); |
|
| 921 | ||
| 922 | add_comment_meta($comments[0], 'foo', 'jjj'); |
|
| 923 | add_comment_meta($comments[1], 'foo', 'zzz'); |
|
| 924 | add_comment_meta($comments[2], 'foo', 'jjj'); |
|
| 925 | ||
| 926 | $q = new WP_Comment_Query( |
|
| 927 | array( |
|
| 928 | 'comment__not_in' => array( $comments[1], $comments[2] ), |
|
| 929 | 'meta_query' => array( |
|
| 930 | array( |
|
| 931 | 'key' => 'foo', |
|
| 932 | 'value' => 'jjj', |
|
| 933 | ), |
|
| 934 | ), |
|
| 935 | 'fields' => 'ids', |
|
| 936 | ) |
|
| 937 | ); |
|
| 938 | ||
| 939 | $this->assertEquals(array( $comments[0] ), $q->get_comments()); |
|
| 940 | } |
|