You are here

function ServicesResourceUsertests::testRegisterUserLegacy in Services 7.3

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

Test register method (Legacy).

TODO: To be removed in future version.

See also

http://drupal.org/node/1083242

File

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

  //Verify logged out state can create users
  $this
    ->drupalLogout();
  $user = array();
  $user['name'] = $this
    ->randomName();
  $user['mail'] = $user['name'] . '@example.com';
  $response = $this
    ->servicesPost($this->endpoint->path . '/user/register', array(
    'account' => $user,
  ));
  $account = $response['body'];
  $this
    ->assertTrue(!empty($account['uid']), 'User has been create successfully.', 'UserResource: Create (Legacy)');

  // Load user.
  $user_load = user_load($account['uid']);
  $this
    ->assertTrue(!empty($user_load), 'Newly created user has been loaded successfully.', 'UserResource: Create (Legacy)');
}