|
@@ 681-702 (lines=22) @@
|
| 678 |
|
$this->assertSame(array( 'author' => true ), $user->caps); |
| 679 |
|
} |
| 680 |
|
|
| 681 |
|
public function test_roles_and_caps_should_be_populated_for_explicit_value_of_different_blog_id_on_ms_when_fields_all_with_meta() |
| 682 |
|
{ |
| 683 |
|
if (! is_multisite() ) { |
| 684 |
|
$this->markTestSkipped(__METHOD__ . ' is a multisite-only test.'); |
| 685 |
|
} |
| 686 |
|
|
| 687 |
|
$b = self::factory()->blog->create(); |
| 688 |
|
|
| 689 |
|
add_user_to_blog($b, self::$author_ids[0], 'author'); |
| 690 |
|
|
| 691 |
|
$query = new WP_User_Query( |
| 692 |
|
array( |
| 693 |
|
'include' => self::$author_ids[0], |
| 694 |
|
'blog_id' => $b, |
| 695 |
|
'fields' => 'all_with_meta', |
| 696 |
|
) |
| 697 |
|
); |
| 698 |
|
|
| 699 |
|
$found = $query->get_results(); |
| 700 |
|
|
| 701 |
|
$this->assertNotEmpty($found); |
| 702 |
|
$user = reset($found); |
| 703 |
|
$this->assertSame(array( 'author' ), $user->roles); |
| 704 |
|
$this->assertSame(array( 'author' => true ), $user->caps); |
| 705 |
|
} |
|
@@ 710-730 (lines=21) @@
|
| 707 |
|
/** |
| 708 |
|
* @ticket 31878 |
| 709 |
|
*/ |
| 710 |
|
public function test_roles_and_caps_should_be_populated_for_explicit_value_of_different_blog_id_on_ms_when_fields_all() |
| 711 |
|
{ |
| 712 |
|
if (! is_multisite() ) { |
| 713 |
|
$this->markTestSkipped(__METHOD__ . ' is a multisite-only test.'); |
| 714 |
|
} |
| 715 |
|
|
| 716 |
|
$b = self::factory()->blog->create(); |
| 717 |
|
add_user_to_blog($b, self::$author_ids[0], 'author'); |
| 718 |
|
|
| 719 |
|
$query = new WP_User_Query( |
| 720 |
|
array( |
| 721 |
|
'fields' => 'all', |
| 722 |
|
'include' => self::$author_ids[0], |
| 723 |
|
'blog_id' => $b, |
| 724 |
|
) |
| 725 |
|
); |
| 726 |
|
|
| 727 |
|
$found = $query->get_results(); |
| 728 |
|
|
| 729 |
|
$this->assertNotEmpty($found); |
| 730 |
|
$user = reset($found); |
| 731 |
|
$this->assertSame(array( 'author' ), $user->roles); |
| 732 |
|
$this->assertSame(array( 'author' => true ), $user->caps); |
| 733 |
|
} |