protected function UserProtectWebTestBase::assertUserNoCanChangePass in User protect 7
Asserts that a account's password can NOT be changed.
Parameters
object $account: The account to change the password for.
string $message: (optional) The message to assert.
File
- tests/
UserProtectWebTestBase.test, line 363 - Contains \UserProtectWebTestBase.
Class
- UserProtectWebTestBase
- Base class for User protect web tests.
Code
protected function assertUserNoCanChangePass($account, $message = NULL) {
if (!is_null($message)) {
$message = "The user's password can NOT be changed.";
}
$expected_pass = $account->pass_raw;
$new_pass = $this
->randomName();
$edit = array(
'current_pass' => $account->pass_raw,
'pass[pass1]' => $new_pass,
'pass[pass2]' => $new_pass,
);
$this
->userprotectPostForm('user/' . $account->uid . '/edit', $edit, t('Save'));
// Assert the password did not change.
$account = user_load($account->uid, TRUE);
$account->pass_raw = $expected_pass;
$this
->drupalLogout();
$this
->drupalLogin($account);
}