/**
* Runs basic tests for node_access function.
*/
public function testNodeAccess() { // Ensures user without 'access content' permission can do nothing.
$web_user1 =
$this->
drupalCreateUser([ 'create page content',
'edit any page content',
'delete any page content',
]);
$node1 =
$this->
drupalCreateNode(['type' => 'page'
]);
$this->
assertNodeCreateAccess($node1->
bundle(), FALSE,
$web_user1);
$this->
assertNodeAccess([ 'view' => FALSE,
'update' => FALSE,
'delete' => FALSE,
],
$node1,
$web_user1);
// Ensures user with 'bypass node access' permission can do everything.
$web_user2 =
$this->
drupalCreateUser(['bypass node access'
]);
$node2 =
$this->
drupalCreateNode(['type' => 'page'
]);
$this->
assertNodeCreateAccess($node2->
bundle(), TRUE,
$web_user2);
$this->
assertNodeAccess([