Changeset 32001
- Timestamp:
- 04/03/2015 02:13:19 PM (10 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/user.php
r31963 r32001 858 858 } elseif ( 'all' == $qv['fields'] ) { 859 859 foreach ( $this->results as $key => $user ) { 860 $this->results[ $key ] = new WP_User( $user );860 $this->results[ $key ] = new WP_User( $user, '', $qv['blog_id'] ); 861 861 } 862 862 } -
trunk/tests/phpunit/tests/user/query.php
r32000 r32001 600 600 $this->assertSame( array( 'author' => true ), $user->caps ); 601 601 } 602 603 /** 604 * @ticket 31878 605 */ 606 public function test_roles_and_caps_should_be_populated_for_explicit_value_of_different_blog_id_on_ms_when_fields_all() { 607 if ( ! is_multisite() ) { 608 $this->markTestSkipped( __METHOD__ . ' is a multisite-only test.' ); 609 } 610 611 $b = $this->factory->blog->create(); 612 $u = $this->factory->user->create(); 613 add_user_to_blog( $b, $u, 'author' ); 614 615 $query = new WP_User_Query( array( 616 'fields' => 'all', 617 'include' => $u, 618 'blog_id' => $b, 619 ) ); 620 621 $found = $query->get_results(); 622 623 $this->assertNotEmpty( $found ); 624 $user = reset( $found ); 625 $this->assertSame( array( 'author' ), $user->roles ); 626 $this->assertSame( array( 'author' => true ), $user->caps ); 627 } 602 628 }
Note: See TracChangeset
for help on using the changeset viewer.