Changeset 39056
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/rest-api/endpoints/class-wp-rest-users-controller.php
r39046 r39056 1011 1011 ), 1012 1012 'context' => array( 'edit' ), 1013 'arg_options' => array( 1014 'sanitize_callback' => 'wp_parse_slug_list', 1015 ), 1013 1016 ), 1014 1017 'password' => array( -
trunk/tests/phpunit/tests/rest-api/rest-users-controller.php
r39043 r39056 905 905 906 906 $user = get_userdata( $user_id ); 907 $this->assertArrayHasKey( 'editor', $user->caps ); 908 $this->assertArrayNotHasKey( 'administrator', $user->caps ); 909 } 910 911 public function test_update_user_multiple_roles() { 912 $user_id = $this->factory->user->create( array( 'role' => 'administrator' ) ); 913 914 wp_set_current_user( self::$user ); 915 $this->allow_user_to_manage_multisite(); 916 917 $request = new WP_REST_Request( 'PUT', sprintf( '/wp/v2/users/%d', $user_id ) ); 918 $request->set_param( 'roles', 'author,editor' ); 919 $response = $this->server->dispatch( $request ); 920 921 $new_data = $response->get_data(); 922 923 $this->assertEquals( array( 'author', 'editor' ), $new_data['roles'] ); 924 925 $user = get_userdata( $user_id ); 926 $this->assertArrayHasKey( 'author', $user->caps ); 907 927 $this->assertArrayHasKey( 'editor', $user->caps ); 908 928 $this->assertArrayNotHasKey( 'administrator', $user->caps );
Note: See TracChangeset
for help on using the changeset viewer.