You are here

public function FieldStorageConfigAccessControlHandlerTest::testAccess in Drupal 9

Same name and namespace in other branches
  1. 8 core/modules/field/tests/src/Unit/FieldStorageConfigAccessControlHandlerTest.php \Drupal\Tests\field\Unit\FieldStorageConfigAccessControlHandlerTest::testAccess()

Ensures field storage config access is working properly.

1 method overrides FieldStorageConfigAccessControlHandlerTest::testAccess()
FieldConfigAccessControlHandlerTest::testAccess in core/modules/field/tests/src/Unit/FieldConfigAccessControlHandlerTest.php
Ensures field config access is working properly.

File

core/modules/field/tests/src/Unit/FieldStorageConfigAccessControlHandlerTest.php, line 179

Class

FieldStorageConfigAccessControlHandlerTest
Tests the field storage config access controller.

Namespace

Drupal\Tests\field\Unit

Code

public function testAccess() {
  $this
    ->assertAllowOperations([], $this->anon);
  $this
    ->assertAllowOperations([
    'view',
    'update',
    'delete',
  ], $this->member);
  $this->entity
    ->setLocked(TRUE)
    ->save();

  // Unfortunately, EntityAccessControlHandler has a static cache, which we
  // therefore must reset manually.
  $this->accessControlHandler
    ->resetCache();
  $this
    ->assertAllowOperations([], $this->anon);
  $this
    ->assertAllowOperations([
    'view',
    'update',
  ], $this->member);
}