You are here

public function EntityAccessControlHandlerTest::testCreateAccess in Entity API 8

@covers ::checkCreateAccess

@dataProvider createAccessProvider

File

tests/src/Unit/EntityAccessControlHandlerTest.php, line 67

Class

EntityAccessControlHandlerTest
@coversDefaultClass \Drupal\entity\EntityAccessControlHandler @group entity

Namespace

Drupal\Tests\entity\Unit

Code

public function testCreateAccess(EntityTypeInterface $entity_type, $bundle, $account, $allowed, $cache_contexts) {
  $handler = new EntityAccessControlHandler($entity_type);
  $handler
    ->setStringTranslation($this
    ->getStringTranslationStub());
  $result = $handler
    ->createAccess($bundle, $account, [], TRUE);
  $this
    ->assertEquals($allowed, $result
    ->isAllowed());
  $this
    ->assertEquals($cache_contexts, $result
    ->getCacheContexts());
}