function ServicesResourceUsertests::testUpdateUser in Services 7.3
Same name and namespace in other branches
- 6.3 tests/functional/ServicesResourceUserTests.test \ServicesResourceUsertests::testUpdateUser()
Test update method.
Create user, update email.
File
- tests/functional/ ServicesResourceUserTests.test, line 273 
- 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 testUpdateUser() {
  // Create user.
  $account = $this
    ->drupalCreateUser();
  // Update mail of the user.
  $updated_account = array(
    'mail' => $this
      ->randomName() . '@example.com',
    'pass' => $this
      ->randomString(),
  );
  $response = $this
    ->servicesPut($this->endpoint->path . '/user/' . $account->uid, $updated_account);
  $user_load = user_load($account->uid);
  $this
    ->assertEqual($updated_account['mail'], $user_load->mail, 'User details have been updated successfully', 'UserResource: Update');
  $this
    ->assertTrue(user_check_password($updated_account['pass'], $user_load), 'Password check succeeds.', 'UserResource: Update');
}