UserEditedOwnAccountTest.php in Zircon Profile 8.0
File
core/modules/user/src/Tests/UserEditedOwnAccountTest.php
View source
<?php
namespace Drupal\user\Tests;
use Drupal\simpletest\WebTestBase;
class UserEditedOwnAccountTest extends WebTestBase {
public static $modules = array(
'user_form_test',
);
function testUserEditedOwnAccount() {
$this
->config('user.settings')
->set('register', USER_REGISTER_ADMINISTRATORS_ONLY)
->save();
$account = $this
->drupalCreateUser(array(
'change own username',
));
$this
->drupalLogin($account);
$edit = array();
$edit['name'] = $this
->randomMachineName();
$this
->drupalPostForm('user/' . $account
->id() . '/edit', $edit, t('Save'));
$this
->drupalLogout();
$account->name = $edit['name'];
$this
->drupalLogin($account);
}
}