Make WordPress Core


Ignore:
Timestamp:
11/02/2016 09:20:12 PM (8 years ago)
Author:
joehoyle
Message:

REST API: Add en_US to the locales enum.

Props ocean90.
Fixes #38528.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/tests/rest-api/rest-users-controller.php

    r39092 r39096  
    837837        $this->assertInstanceOf( 'WP_Error', $response->as_error() );
    838838        $this->assertEquals( 'rest_invalid_param', $response->as_error()->get_error_code() );
     839    }
     840
     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 );
    839853    }
    840854
Note: See TracChangeset for help on using the changeset viewer.