You are here

function EntityAccessControlHandlerTest::assertEntityAccess in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/modules/system/src/Tests/Entity/EntityAccessControlHandlerTest.php \Drupal\system\Tests\Entity\EntityAccessControlHandlerTest::assertEntityAccess()

Asserts entity access correctly grants or denies access.

4 calls to EntityAccessControlHandlerTest::assertEntityAccess()
EntityAccessControlHandlerTest::testDefaultEntityAccess in core/modules/system/src/Tests/Entity/EntityAccessControlHandlerTest.php
Ensures default entity access is checked when necessary.
EntityAccessControlHandlerTest::testEntityAccess in core/modules/system/src/Tests/Entity/EntityAccessControlHandlerTest.php
Ensures entity access is properly working.
EntityAccessControlHandlerTest::testEntityAccessDefaultController in core/modules/system/src/Tests/Entity/EntityAccessControlHandlerTest.php
Ensures that the default handler is used as a fallback.
EntityAccessControlHandlerTest::testEntityTranslationAccess in core/modules/system/src/Tests/Entity/EntityAccessControlHandlerTest.php
Ensures entity access for entity translations is properly working.

File

core/modules/system/src/Tests/Entity/EntityAccessControlHandlerTest.php, line 30
Contains \Drupal\system\Tests\Entity\EntityAccessControlHandlerTest.

Class

EntityAccessControlHandlerTest
Tests the entity access control handler.

Namespace

Drupal\system\Tests\Entity

Code

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