public function NodeTestBase::assertNodeAccess in Drupal 9
Same name and namespace in other branches
- 8 core/modules/node/tests/src/Functional/NodeTestBase.php \Drupal\Tests\node\Functional\NodeTestBase::assertNodeAccess()
Asserts that node access correctly grants or denies access.
Parameters
array $ops: An associative array of the expected node access grants for the node 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\node\NodeInterface $node: The node object to check.
\Drupal\Core\Session\AccountInterface $account: The user account for which to check access.
File
- core/
modules/ node/ tests/ src/ Functional/ NodeTestBase.php, line 60
Class
- NodeTestBase
- Sets up page and article content types.
Namespace
Drupal\Tests\node\FunctionalCode
public function assertNodeAccess(array $ops, NodeInterface $node, AccountInterface $account) {
foreach ($ops as $op => $result) {
$this
->assertEquals($this->accessHandler
->access($node, $op, $account), $result, $this
->nodeAccessAssertMessage($op, $result, $node
->language()
->getId()));
}
}