public function NodeTestBase::assertNodeAccess in Drupal 8
Same name in this branch
- 8 core/modules/node/src/Tests/NodeTestBase.php \Drupal\node\Tests\NodeTestBase::assertNodeAccess()
- 8 core/modules/node/tests/src/Functional/NodeTestBase.php \Drupal\Tests\node\Functional\NodeTestBase::assertNodeAccess()
Same name and namespace in other branches
- 9 core/modules/node/tests/src/Functional/NodeTestBase.php \Drupal\Tests\node\Functional\NodeTestBase::assertNodeAccess()
- 10 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
->assertEqual($result, $this->accessHandler
->access($node, $op, $account), $this
->nodeAccessAssertMessage($op, $result, $node
->language()
->getId()));
}
}