Mercurial > hg > cmmr2012-drupal-site
view core/modules/user/tests/src/Functional/UserEditedOwnAccountTest.php @ 0:c75dbcec494b
Initial commit from drush-created site
author | Chris Cannam |
---|---|
date | Thu, 05 Jul 2018 14:24:15 +0000 |
parents | |
children | 12f9dff5fda9 |
line wrap: on
line source
<?php namespace Drupal\Tests\user\Functional; use Drupal\Tests\BrowserTestBase; /** * Tests user edited own account can still log in. * * @group user */ class UserEditedOwnAccountTest extends BrowserTestBase { public function testUserEditedOwnAccount() { // Change account setting 'Who can register accounts?' to Administrators // only. $this->config('user.settings')->set('register', USER_REGISTER_ADMINISTRATORS_ONLY)->save(); // Create a new user account and log in. $account = $this->drupalCreateUser(['change own username']); $this->drupalLogin($account); // Change own username. $edit = []; $edit['name'] = $this->randomMachineName(); $this->drupalPostForm('user/' . $account->id() . '/edit', $edit, t('Save')); // Log out. $this->drupalLogout(); // Set the new name on the user account and attempt to log back in. $account->name = $edit['name']; $this->drupalLogin($account); } }