function FieldStorageConfigAccessControlHandlerTest::testAccess

Same name in other branches
  1. 9 core/modules/field/tests/src/Unit/FieldStorageConfigAccessControlHandlerTest.php \Drupal\Tests\field\Unit\FieldStorageConfigAccessControlHandlerTest::testAccess()
  2. 8.9.x core/modules/field/tests/src/Unit/FieldStorageConfigAccessControlHandlerTest.php \Drupal\Tests\field\Unit\FieldStorageConfigAccessControlHandlerTest::testAccess()
  3. 11.x 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() : void {
    $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);
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.