You are here

function ServicesResourceUsertests::testUpdateUserName in Services 7.3

Test updateing a username with administer users permission #1853592.

Create user, update email.

File

tests/functional/ServicesResourceUserTests.test, line 194
Call the endpoint tests when no authentication is being used.

Class

ServicesResourceUsertests
Run test cases for the endpoint with no authentication turned on.

Code

function testUpdateUserName() {

  // Create user.
  $account = $this
    ->drupalCreateUser();
  $name = $this
    ->randomName();

  // Update mail of the user.
  $updated_account = array(
    'name' => $name,
  );
  $response = $this
    ->servicesPut($this->endpoint->path . '/user/' . $account->uid, $updated_account);
  $user_load = user_load($account->uid);
  $this
    ->assertEqual($name, $user_load->name, 'You are allowed to change a username as administer users perm.', 'User Resource : Test to check for drupal.org issue #1853592');
}