You are here

public function UserProtectionPermissionsTest::testEditOwnAccount in User protect 8

Tests edit account with permission "userprotect.account.edit".

Tests if an user with the permission "userprotect.account.edit" can edit its own account.

File

tests/src/Functional/UserProtectionPermissionsTest.php, line 128

Class

UserProtectionPermissionsTest
Tests if "change own" User Protect permissions are respected.

Namespace

Drupal\Tests\userprotect\Functional

Code

public function testEditOwnAccount() {

  // Create an account that may edit its own account.
  $account = $this
    ->drupalCreateUser([
    'userprotect.account.edit',
  ]);
  $this
    ->drupalLogin($account);

  // Assert the user can edit its own account.
  $this
    ->drupalGet('user/' . $account
    ->id() . '/edit');
  $this
    ->assertResponse(200, "The user may edit its own account.");
}