You are here

protected function UserProtectionPermissionsTest::setUp in User protect 8

Overrides BrowserTestBase::setUp

File

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

Class

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

Namespace

Drupal\Tests\userprotect\Functional

Code

protected function setUp() {
  parent::setUp();

  // Revoke default permissions on the authenticated user role that are
  // installed by the userprotect module.
  // @see userprotect_install().
  $role = \Drupal::entityTypeManager()
    ->getStorage('user_role')
    ->load(AccountInterface::AUTHENTICATED_ROLE);
  $role
    ->revokePermission('userprotect.mail.edit');
  $role
    ->revokePermission('userprotect.pass.edit');
  $role
    ->revokePermission('userprotect.account.edit');
  $role
    ->save();
}