protected function UserProtectWebTestBase::assertUserNoCanChangeName in User protect 7
Asserts that a account's name can NOT be changed.
Parameters
object $account: The account to change the username for.
string $message: (optional) The message to assert.
File
- tests/
UserProtectWebTestBase.test, line 260 - Contains \UserProtectWebTestBase.
Class
- UserProtectWebTestBase
- Base class for User protect web tests.
Code
protected function assertUserNoCanChangeName($account, $message = NULL) {
if (!is_null($message)) {
$message = "The user's name can NOT be changed.";
}
// Remember the user's name.
$expected_name = $account->name;
$edit = array(
'name' => $this
->randomName(),
);
$this
->userprotectPostForm('user/' . $account->uid . '/edit', $edit, t('Save'));
// Re-load the user and check the user name didn't change.
$account = user_load($account->uid, TRUE);
$this
->assertEqual($expected_name, $account->name, $message);
}