You are here

public function ProtectedNodeViewMode::testNotAllowedView in Protected Node 7

Same name and namespace in other branches
  1. 1.0.x tests/protected_node.view_mode.test \ProtectedNodeViewMode::testNotAllowedView()

Test function.

Test that a promoted protected node can be seen on the front page (unprotected view mode: teaser) by an authenticated but not allowed user.

File

tests/protected_node.view_mode.test, line 70
Test protected node view mode functionality.

Class

ProtectedNodeViewMode
Configure protected_node to use per node password.

Code

public function testNotAllowedView() {

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

  // Generate random password.
  $password = $this
    ->randomName(10);

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

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

  // User that can see published content sees the node.
  $this
    ->drupalLogin($this->normalNonAccessAllowedUser);
  $this
    ->drupalGet('');
  $text = $node->body[LANGUAGE_NONE][0]['value'];
  $this
    ->assertText($text, "User with no access permission is allowed to access a protected node in an unprotected view mode", $this->group);
}