function EntityAccessControlHandlerTest::assertEntityAccess

Same name in other branches
  1. 8.9.x core/tests/Drupal/KernelTests/Core/Entity/EntityAccessControlHandlerTest.php \Drupal\KernelTests\Core\Entity\EntityAccessControlHandlerTest::assertEntityAccess()
  2. 10 core/tests/Drupal/KernelTests/Core/Entity/EntityAccessControlHandlerTest.php \Drupal\KernelTests\Core\Entity\EntityAccessControlHandlerTest::assertEntityAccess()
  3. 11.x core/tests/Drupal/KernelTests/Core/Entity/EntityAccessControlHandlerTest.php \Drupal\KernelTests\Core\Entity\EntityAccessControlHandlerTest::assertEntityAccess()

Asserts entity access correctly grants or denies access.

@internal

5 calls to EntityAccessControlHandlerTest::assertEntityAccess()
EntityAccessControlHandlerTest::testDefaultEntityAccess in core/tests/Drupal/KernelTests/Core/Entity/EntityAccessControlHandlerTest.php
Ensures default entity access is checked when necessary.
EntityAccessControlHandlerTest::testEntityAccess in core/tests/Drupal/KernelTests/Core/Entity/EntityAccessControlHandlerTest.php
Ensures entity access is properly working.
EntityAccessControlHandlerTest::testEntityAccessDefaultController in core/tests/Drupal/KernelTests/Core/Entity/EntityAccessControlHandlerTest.php
Ensures that the default handler is used as a fallback.
EntityAccessControlHandlerTest::testEntityTranslationAccess in core/tests/Drupal/KernelTests/Core/Entity/EntityAccessControlHandlerTest.php
Ensures entity access for entity translations is properly working.
EntityAccessControlHandlerTest::testUserLabelAccess in core/tests/Drupal/KernelTests/Core/Entity/EntityAccessControlHandlerTest.php
Ensures user labels are accessible for everyone.

File

core/tests/Drupal/KernelTests/Core/Entity/EntityAccessControlHandlerTest.php, line 44

Class

EntityAccessControlHandlerTest
Tests the entity access control handler.

Namespace

Drupal\KernelTests\Core\Entity

Code

public function assertEntityAccess(array $ops, AccessibleInterface $object, AccountInterface $account = NULL) : void {
    foreach ($ops as $op => $result) {
        $message = new FormattableMarkup("Entity access returns @result with operation '@op'.", [
            '@result' => !isset($result) ? 'null' : ($result ? 'true' : 'false'),
            '@op' => $op,
        ]);
        $this->assertEquals($object->access($op, $account), $result, $message);
    }
}

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