You are here

public function EntityPrintAccessTest::accessPermissionsDataProvider in Entity Print 8.2

Data provider to test access with different combinations of permissions.

File

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

Class

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

Namespace

Drupal\Tests\entity_print\Kernel

Code

public function accessPermissionsDataProvider() {
  return [
    'Permission "bypass entity print access" only cannot view PDF.' => [
      [
        'bypass entity print access',
      ],
      FALSE,
    ],
    'Permission "access content" only cannot view PDF.' => [
      [
        'access content',
      ],
      FALSE,
    ],
    'Permission "access content" and "bypass entity print access" can view PDF.' => [
      [
        'bypass entity print access',
        'access content',
      ],
      TRUE,
    ],
    'Per entity type permissions allow access.' => [
      [
        'entity print access type node',
        'access content',
      ],
      TRUE,
    ],
    'Per bundle permissions allow access.' => [
      [
        'entity print access bundle page',
        'access content',
      ],
      TRUE,
    ],
    'Incorrect entity type permission cannot access' => [
      [
        'entity print access type user',
        'access content',
      ],
      FALSE,
    ],
    'Incorrect bundle permissions cannot access' => [
      [
        'entity print access bundle article',
        'access content',
      ],
      FALSE,
    ],
    'No permissions cannot access' => [
      [],
      FALSE,
    ],
  ];
}