WordPress.org

Make WordPress Core

Ticket #38528: 38528.3.diff

File 38528.3.diff, 1.1 KB (added by ocean90, 5 years ago)
  • rest-users-controller.php

     
    838838                $this->assertEquals( 'rest_invalid_param', $response->as_error()->get_error_code() );
    839839        }
    840840
     841        public function test_update_item_en_US_locale() {
     842                $user_id = $this->factory->user->create( array( 'user_login' => 'test_json_user', 'user_email' => 'testjson@example.com' ) );
     843                $this->allow_user_to_manage_multisite();
     844                wp_set_current_user( self::$user );
     845
     846                $request = new WP_REST_Request( 'PUT', '/wp/v2/users/' . $user_id );
     847                $request->set_param( 'locale', 'en_US' );
     848                $response = $this->server->dispatch( $request );
     849                $this->check_add_edit_user_response( $response, true );
     850
     851                $user = get_userdata( $user_id );
     852                $this->assertEquals( 'en_US', $user->locale );
     853        }
     854
    841855        public function test_update_item_username_attempt() {
    842856                $user1 = $this->factory->user->create( array( 'user_login' => 'test_json_user', 'user_email' => 'testjson@example.com' ) );
    843857                $user2 = $this->factory->user->create( array( 'user_login' => 'test_json_user2', 'user_email' => 'testjson2@example.com' ) );