You are here

protected function EntityPrintAccessTest::checkAccess in Entity Print 8.2

Checks access for the user to print the view.

Parameters

\Drupal\Core\Session\AccountInterface $account: The account we're checking against.

string $entity_type: The entity type string.

string $entity_id: The entity id.

string $export_type: The export type.

Return value

bool TRUE if the user has access otherwise FALSE.

2 calls to EntityPrintAccessTest::checkAccess()
EntityPrintAccessTest::testInvalidRouteParameters in tests/src/Kernel/EntityPrintAccessTest.php
Test invalid route parameters.
EntityPrintAccessTest::testSecondaryEntityTypeAccess in tests/src/Kernel/EntityPrintAccessTest.php
Test access for a non-node entity type.

File

tests/src/Kernel/EntityPrintAccessTest.php, line 148

Class

EntityPrintAccessTest
@coversDefaultClass \Drupal\entity_print\Controller\EntityPrintController @group entity_print

Namespace

Drupal\Tests\entity_print\Kernel

Code

protected function checkAccess(AccountInterface $account, $entity_type, $entity_id, $export_type = 'pdf') {
  $this->container
    ->get('current_user')
    ->setAccount($account);
  $controller = EntityPrintController::create($this->container);
  return $controller
    ->checkAccess($export_type, $entity_type, $entity_id)
    ->isAllowed();
}