You are here

public function FieldPermissionsUserTest::setUp in Field Permissions 8

Same name and namespace in other branches
  1. 8.2 tests/src/Functional/FieldPermissionsUserTest.php \Drupal\Tests\field_permissions\Functional\FieldPermissionsUserTest::setUp()

Overrides FieldPermissionsTestBase::setUp

File

tests/src/Functional/FieldPermissionsUserTest.php, line 27

Class

FieldPermissionsUserTest
Test field permissions on users.

Namespace

Drupal\Tests\field_permissions\Functional

Code

public function setUp() {
  parent::setUp();
  $this->fieldName = mb_strtolower($this
    ->randomMachineName());

  // Remove the '@' symbol so it isn't converted to an email link.
  $this->fieldText = str_replace('@', '', $this
    ->randomString(42));

  // Allow the web user to administer user profiles.
  $this->webUserRole
    ->grantPermission('access user profiles')
    ->grantPermission('administer users')
    ->save();
  $this->entityDisplayRepository = $this->container
    ->get('entity_display.repository');
  $this
    ->addUserField();
}