| @@ 2235-2252 (lines=18) @@ | ||
| 2232 | /** |
|
| 2233 | * @ticket 32762 |
|
| 2234 | */ |
|
| 2235 | public function test_it_should_be_possible_to_modify_meta_query_using_pre_get_comments_action() |
|
| 2236 | { |
|
| 2237 | $comments = self::factory()->comment->create_many( |
|
| 2238 | 2, array( |
|
| 2239 | 'comment_post_ID' => self::$post_id, |
|
| 2240 | ) |
|
| 2241 | ); |
|
| 2242 | ||
| 2243 | add_comment_meta($comments[1], 'foo', 'bar'); |
|
| 2244 | ||
| 2245 | add_action('pre_get_comments', array( $this, 'modify_meta_query' )); |
|
| 2246 | ||
| 2247 | $q = new WP_Comment_Query( |
|
| 2248 | array( |
|
| 2249 | 'comment_post_ID' => self::$post_id, |
|
| 2250 | 'fields' => 'ids', |
|
| 2251 | ) |
|
| 2252 | ); |
|
| 2253 | ||
| 2254 | remove_action('pre_get_comments', array( $this, 'modify_meta_query' )); |
|
| 2255 | ||
| @@ 2274-2291 (lines=18) @@ | ||
| 2271 | /** |
|
| 2272 | * @ticket 32762 |
|
| 2273 | */ |
|
| 2274 | public function test_it_should_be_possible_to_modify_meta_params_using_pre_get_comments_action() |
|
| 2275 | { |
|
| 2276 | $comments = self::factory()->comment->create_many( |
|
| 2277 | 2, array( |
|
| 2278 | 'comment_post_ID' => self::$post_id, |
|
| 2279 | ) |
|
| 2280 | ); |
|
| 2281 | ||
| 2282 | add_comment_meta($comments[1], 'foo', 'bar'); |
|
| 2283 | ||
| 2284 | add_action('pre_get_comments', array( $this, 'modify_meta_params' )); |
|
| 2285 | ||
| 2286 | $q = new WP_Comment_Query( |
|
| 2287 | array( |
|
| 2288 | 'comment_post_ID' => self::$post_id, |
|
| 2289 | 'fields' => 'ids', |
|
| 2290 | ) |
|
| 2291 | ); |
|
| 2292 | ||
| 2293 | remove_action('pre_get_comments', array( $this, 'modify_meta_params' )); |
|
| 2294 | ||