diff --git tests/phpunit/testcases/core/class-bp-user-query.php tests/phpunit/testcases/core/class-bp-user-query.php
index 46fda6c..a32e5c6 100644
|
|
class BP_Tests_BP_User_Query_TestCases extends BP_UnitTestCase { |
367 | 367 | $this->assertNotContains( $u1, $found_user_ids ); |
368 | 368 | } |
369 | 369 | |
| 370 | /** |
| 371 | * @group meta |
| 372 | * @group BP5904 |
| 373 | */ |
| 374 | public function test_bp_user_query_with_user_meta_argument() { |
| 375 | $u1 = $this->create_user(); |
| 376 | $u2 = $this->create_user(); |
| 377 | |
| 378 | bp_update_user_meta( $u2, 'foo', 'bar' ); |
| 379 | |
| 380 | $q = new BP_User_Query( array( |
| 381 | 'meta_key' => 'foo', |
| 382 | 'meta_value' => 'bar', |
| 383 | ) ); |
| 384 | |
| 385 | $found_user_ids = array_values( wp_parse_id_list( wp_list_pluck( $q->results, 'ID' ) ) ); |
| 386 | |
| 387 | // Do a assertNotContains because there are weird issues with user #1 as created by WP |
| 388 | $this->assertNotContains( $u1, $found_user_ids ); |
| 389 | $this->assertEquals( array( $u2 ), $found_user_ids ); |
| 390 | } |
| 391 | |
| 392 | /** |
| 393 | * @group meta |
| 394 | * @group BP5904 |
| 395 | */ |
| 396 | public function test_bp_user_query_with_user_meta_argument_no_user() { |
| 397 | $u1 = $this->create_user(); |
| 398 | $u2 = $this->create_user(); |
| 399 | |
| 400 | $q = new BP_User_Query( array( |
| 401 | 'meta_key' => 'foo', |
| 402 | 'meta_value' => 'bar', |
| 403 | ) ); |
| 404 | |
| 405 | $found_user_ids = array_values( wp_parse_id_list( wp_list_pluck( $q->results, 'ID' ) ) ); |
| 406 | |
| 407 | $this->assertEmpty( $found_user_ids ); |
| 408 | } |
| 409 | |
370 | 410 | } |