public function UserProtectionPermissionsTest::testNoEditOwnAccount in User protect 8
Tests edit account without permission "userprotect.account.edit".
Tests if an user without the permission "userprotect.account.edit" can not edit its own account.
File
- tests/
src/ Functional/ UserProtectionPermissionsTest.php, line 144
Class
- UserProtectionPermissionsTest
- Tests if "change own" User Protect permissions are respected.
Namespace
Drupal\Tests\userprotect\FunctionalCode
public function testNoEditOwnAccount() {
// Create an account that may NOT edit its own account.
$account = $this
->drupalCreateUser();
$this
->drupalLogin($account);
// Assert the user can edit its own account.
$this
->drupalGet('user/' . $account
->id() . '/edit');
$this
->assertResponse(403, "The user may NOT edit its own account.");
}