Skip to content
This repository was archived by the owner on Sep 24, 2018. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion lib/endpoints/class-wp-rest-users-controller.php
Original file line number Diff line number Diff line change
Expand Up @@ -692,7 +692,6 @@ public function get_item_schema() {
'type' => 'string',
'format' => 'uri',
'context' => array( 'embed', 'view', 'edit' ),
'readonly' => true,
),
'description' => array(
'description' => __( 'Description of the resource.' ),
Expand Down
7 changes: 7 additions & 0 deletions tests/test-rest-users-controller.php
Original file line number Diff line number Diff line change
Expand Up @@ -473,6 +473,8 @@ public function test_create_item() {
$request->set_body_params( $params );

$response = $this->server->dispatch( $request );
$data = $response->get_data();
$this->assertEquals( 'http://example.com', $data['url'] );
$this->check_add_edit_user_response( $response );
}

Expand Down Expand Up @@ -573,6 +575,7 @@ public function test_update_item() {
'user_pass' => 'sjflsfls',
'user_login' => 'test_update',
'first_name' => 'Old Name',
'user_url' => 'http://apple.com',
));
$this->allow_user_to_manage_multisite();
wp_set_current_user( $this->user );
Expand All @@ -583,6 +586,7 @@ public function test_update_item() {
$_POST['email'] = $userdata->user_email;
$_POST['username'] = $userdata->user_login;
$_POST['first_name'] = 'New Name';
$_POST['url'] = 'http://google.com';

$request = new WP_REST_Request( 'PUT', sprintf( '/wp/v2/users/%d', $user_id ) );
$request->add_header( 'content-type', 'application/x-www-form-urlencoded' );
Expand All @@ -597,6 +601,9 @@ public function test_update_item() {
$user = get_userdata( $user_id );
$this->assertEquals( 'New Name', $user->first_name );

$this->assertEquals( 'http://google.com', $new_data['url'] );
$this->assertEquals( 'http://google.com', $user->user_url );

// Check that we haven't inadvertently changed the user's password,
// as per https://core.trac.wordpress.org/ticket/21429
$this->assertEquals( $pw_before, $user->user_pass );
Expand Down