function EntityFormDisplayAccessControlHandlerTest::testAccess

Same name and namespace in other branches
  1. 8.9.x core/tests/Drupal/Tests/Core/Entity/Access/EntityFormDisplayAccessControlHandlerTest.php \Drupal\Tests\Core\Entity\Access\EntityFormDisplayAccessControlHandlerTest::testAccess()
  2. 10 core/tests/Drupal/Tests/Core/Entity/Access/EntityFormDisplayAccessControlHandlerTest.php \Drupal\Tests\Core\Entity\Access\EntityFormDisplayAccessControlHandlerTest::testAccess()
  3. 11.x core/tests/Drupal/Tests/Core/Entity/Access/EntityFormDisplayAccessControlHandlerTest.php \Drupal\Tests\Core\Entity\Access\EntityFormDisplayAccessControlHandlerTest::testAccess()

@covers ::access @covers ::checkAccess

File

core/tests/Drupal/Tests/Core/Entity/Access/EntityFormDisplayAccessControlHandlerTest.php, line 216

Class

EntityFormDisplayAccessControlHandlerTest
@coversDefaultClass <a href="/api/drupal/core%21lib%21Drupal%21Core%21Entity%21Entity%21Access%21EntityFormDisplayAccessControlHandler.php/class/EntityFormDisplayAccessControlHandler/9" title="Provides an entity access control handler for form displays." class="local">\Drupal\Core\Entity\Entity\Access\EntityFormDisplayAccessControlHandler</a> @group Entity

Namespace

Drupal\Tests\Core\Entity\Access

Code

public function testAccess() {
    $this->assertAllowOperations([], $this->anon);
    $this->assertAllowOperations([
        'view',
        'update',
        'delete',
    ], $this->member);
    $this->assertAllowOperations([
        'view',
        'update',
        'delete',
    ], $this->parent_member);
    $this->entity
        ->enforceIsNew(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);
    $this->assertAllowOperations([
        'view',
        'update',
    ], $this->parent_member);
}

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