You are here

protected function FieldPermissionsUserTest::checkPrivateField 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::checkPrivateField()

Test field access with private permissions.

1 call to FieldPermissionsUserTest::checkPrivateField()
FieldPermissionsUserTest::testUserFieldPermissions in tests/src/Functional/FieldPermissionsUserTest.php
Test field permissions on user entities.

File

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

Class

FieldPermissionsUserTest
Test field permissions on users.

Namespace

Drupal\Tests\field_permissions\Functional

Code

protected function checkPrivateField() {
  $this
    ->drupalLogin($this->webUser);
  $this
    ->setUserFieldPermission(FieldPermissionTypeInterface::ACCESS_PRIVATE);
  $this
    ->drupalLogout();
  $this
    ->drupalLogin($this->limitedUser);

  // Controlla il perofilo dell'utente admin e non deve vedere il campo.
  $this
    ->assertUserFieldNoAccess($this->adminUser);

  // Compila il campo per l'utente Limited.
  $this
    ->checkUserFieldEdit($this->limitedUser);

  // Controlla che sia visibile.
  $this
    ->assertUserFieldAccess($this->limitedUser);
  $this
    ->drupalLogout();
  $this
    ->drupalLogin($this->webUser);
  $this
    ->assertUserFieldNoAccess($this->limitedUser);
  $this
    ->assertUserEditFieldNoAccess($this->limitedUser);
  $this
    ->drupalLogout();
}