You are here

public function PreviewLinkAccessTest::testPreviewAccessDenied in Preview Link 2.x

Same name and namespace in other branches
  1. 8 tests/src/Kernel/PreviewLinkAccessTest.php \Drupal\Tests\preview_link\Kernel\PreviewLinkAccessTest::testPreviewAccessDenied()
  2. 2.0.x tests/src/Kernel/PreviewLinkAccessTest.php \Drupal\Tests\preview_link\Kernel\PreviewLinkAccessTest::testPreviewAccessDenied()

Test the preview access service.

@dataProvider previewAccessDeniedDataProvider

File

tests/src/Kernel/PreviewLinkAccessTest.php, line 65

Class

PreviewLinkAccessTest
Test preview link access.

Namespace

Drupal\Tests\preview_link\Kernel

Code

public function testPreviewAccessDenied($entity_type_id, $entity_id, $token, $expected_result) : void {
  $entity = $this->container
    ->get('entity_type.manager')
    ->getStorage($entity_type_id)
    ->load($entity_id);
  $access = $this->container
    ->get('access_check.preview_link')
    ->access($entity, $token);
  $this
    ->assertEquals($expected_result, $access
    ->isAllowed());
}