You are here

protected function UserProtectWebTestBase::assertUserCanChangeName in User protect 7

Asserts that a account's name can be changed.

Parameters

object $account: The account to change the username for.

string $message: (optional) The message to assert.

File

tests/UserProtectWebTestBase.test, line 237
Contains \UserProtectWebTestBase.

Class

UserProtectWebTestBase
Base class for User protect web tests.

Code

protected function assertUserCanChangeName($account, $message = NULL) {
  if (!is_null($message)) {
    $message = "The user's name can be changed.";
  }
  $edit = array(
    'name' => $this
      ->randomName(),
  );
  $this
    ->drupalPost('user/' . $account->uid . '/edit', $edit, t('Save'));

  // Re-load the user and assert the user name address changed.
  $account = user_load($account->uid, TRUE);
  $this
    ->assertEqual($edit['name'], $account->name, $message);
}