You are here

function ModuleGrantsBaseTestCase::assertNodeAccess in Module Grants 7

Asserts node_access() correctly grants or denies access. Copied from node.test

1 call to ModuleGrantsBaseTestCase::assertNodeAccess()
ModuleGrantsBaseTestCase::assetNodeViewAccess in ./module_grants.test
node_accesses: array of node title => true/false

File

./module_grants.test, line 177

Class

ModuleGrantsBaseTestCase

Code

function assertNodeAccess($ops, $node, $account) {
  foreach ($ops as $op => $result) {
    $msg = t("node_access returns @result with operation '@op' for node '@title' with user permissions @permissions, lenient mode @lenient.", array(
      '@result' => $result ? 'true' : 'false',
      '@op' => $op,
      '@title' => $node->title,
      '@permissions' => implode(',', $this
        ->getUserPermissions($account)),
      '@lenient' => variable_get('module_grants_lenient', true) ? 'on' : 'off',
    ));
    $this
      ->assertEqual($result, node_access($op, $node, $account), $msg);
  }
}