function ServicesResourceUsertests::testPasswordReset in Services 7.3
Test password_reset method.
File
- tests/
functional/ ServicesResourceUserTests.test, line 362 - 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 testPasswordReset() {
// Create user.
$account = $this
->drupalCreateUser(array(
'administer services',
));
// Password Reset user.
$response = $this
->servicesPost($this->endpoint->path . '/user/' . $account->uid . '/password_reset');
$this
->assertTrue($response['body'], 'Resource has to reset a users password has been called successfully.', 'UserResource: password_reset');
$user_load = user_load($account->uid);
$this
->assertFalse(user_check_password($account->pass, $user_load), 'Password successfully changed.', 'UserResource: password_reset');
}