You are here

public function ProtectedNodeViewMode::testAllowedView in Protected Node 7

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

Test function.

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

File

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

Class

ProtectedNodeViewMode
Configure protected_node to use per node password.

Code

public function testAllowedView() {

  // 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();

  // An authenticated user sees the node.
  $this
    ->drupalLogin($this->normalAccessAllowedUser);
  $this
    ->drupalGet('');
  $text = $node->body[LANGUAGE_NONE][0]['value'];
  $this
    ->assertText($text, "User with right permission can access a protected node without password in an unprotected view mode", $this->group);
}