- Timestamp:
- 10/31/2016 11:10:37 AM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
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.