public function UserProtectionPermissionsTest::testNoEditOwnPass in User protect 8
Tests edit password without permission "userprotect.pass.edit".
Tests if an user without the permission "userprotect.pass.edit" cannot edit its own password.
File
- tests/
src/ Functional/ UserProtectionPermissionsTest.php, line 111
Class
- UserProtectionPermissionsTest
- Tests if "change own" User Protect permissions are respected.
Namespace
Drupal\Tests\userprotect\FunctionalCode
public function testNoEditOwnPass() {
// Create account that may NOT edit its own password.
$account = $this
->drupalCreateUser([
'userprotect.account.edit',
]);
$expected_pass = $account->pass_raw;
$this
->drupalLogin($account);
$this
->drupalGet('user/' . $account
->id() . '/edit');
$this
->assertSession()
->fieldNotExists('pass[pass1]');
$this
->assertSession()
->fieldNotExists('pass[pass2]');
}