You are here

public function LinkCheckerLinkAccessTest::assertLinkAccess in Link checker 8

Asserts that link access correctly grants or denies access.

Parameters

array $ops: An associative array of the expected link access grants for the link and account, with each key as the name of an operation (e.g. 'view', 'delete') and each value a Boolean indicating whether access to that operation should be granted.

\Drupal\linkchecker\LinkCheckerLinkInterface $link: The link object to check.

\Drupal\Core\Session\AccountInterface $account: The user account for which to check access.

1 call to LinkCheckerLinkAccessTest::assertLinkAccess()
LinkCheckerLinkAccessTest::testLinkAccess in tests/src/Kernel/LinkCheckerLinkAccessTest.php
Runs basic tests for link access.

File

tests/src/Kernel/LinkCheckerLinkAccessTest.php, line 207

Class

LinkCheckerLinkAccessTest
Tests basic linkchecker link access functionality.

Namespace

Drupal\Tests\linkchecker\Kernel

Code

public function assertLinkAccess(array $ops, LinkCheckerLinkInterface $link, AccountInterface $account) {
  foreach ($ops as $op => $result) {
    $this
      ->assertEquals($result, $this->accessHandler
      ->access($link, $op, $account), $this
      ->linkAccessAssertMessage($op, $result));
  }
}