1 node_access_example.test protected NodeAccessExampleTestCase::checkNodeAccess($nid, $grant_view, $grant_update, $grant_delete)

Helper function.

Test if a node with the id $nid has expected access grants.

Parameters

int $nid: Node that will be checked.

Return value

bool: Checker ran successfully

File

modules/examples/node_access_example/tests/node_access_example.test, line 281
Tests for Node Access example module.

Class

NodeAccessExampleTestCase
Functional tests for the Node Access Example module.

Code

protected function checkNodeAccess($nid, $grant_view, $grant_update, $grant_delete) {
  // Test if node can be viewed.
  if (!$this->checkResponse($grant_view, 'node/' . $nid)) {
    return FALSE;
  }

  // Test if private node can be edited.
  if (!$this->checkResponse($grant_update, 'node/' . $nid . '/edit')) {
    return FALSE;
  }

  // Test if private node can be deleted.
  if (!$this->checkResponse($grant_delete, 'node/' . $nid . '/delete')) {
    return FALSE;
  }

  return TRUE;
}