You are here

public function ProtectedNodeGlobalPassword::testAuthenticatedNonAllowedView in Protected Node 7

Same name and namespace in other branches
  1. 1.0.x tests/protected_node.global.test \ProtectedNodeGlobalPassword::testAuthenticatedNonAllowedView()

Test function.

Test that a node protected with global protection can't be seen by an authenticated but not allowed user.

File

tests/protected_node.global.test, line 106
Test protected node global password functionality.

Class

ProtectedNodeGlobalPassword
Configure protected_node to use global password.

Code

public function testAuthenticatedNonAllowedView() {

  // Log in as Admin.
  $this
    ->drupalLogin($this->adminUser);

  // Create a new page node.
  $node = $this
    ->createProtectedNode();

  // Once the node created logout the user.
  $this
    ->drupalLogout();

  // User that can see published content sees the node.
  $this
    ->drupalLogin($this->normalNonAccessAllowedUser);
  $this
    ->drupalGet('node/' . $node->nid);
  $this
    ->assertResponse(403, "User with no access permission is not allowed to access a protected node");
}