You are here

function ServicesResourceUsertests::testUpdateUserLegacy in Services 7.3

Same name and namespace in other branches
  1. 6.3 tests/functional/ServicesResourceUserTests.test \ServicesResourceUsertests::testUpdateUserLegacy()

Test update method (Legacy).

TODO: To be removed in future version.

See also

http://drupal.org/node/1083242

File

tests/functional/ServicesResourceUserTests.test, line 297
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 testUpdateUserLegacy() {

  // 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, array(
    'data' => $updated_account,
  ));
  $user_load = user_load($account->uid);
  $this
    ->assertEqual($updated_account['mail'], $user_load->mail, 'User details have been updated successfully', 'UserResource: Update (Legacy)');
  $this
    ->assertTrue(user_check_password($updated_account['pass'], $user_load), 'Password check succeeds.', 'UserResource: Update (Legacy)');
}