You are here

public function ProtectedNodeViewMode::createPromotedProtectedNode in Protected Node 7

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

Helper method to create a promoted protected node.

Please make sure the user has the permission to create the node before calling the method.

Parameters

string $password: A password.

Return value

object A node object.

2 calls to ProtectedNodeViewMode::createPromotedProtectedNode()
ProtectedNodeViewMode::testAllowedView in tests/protected_node.view_mode.test
Test function.
ProtectedNodeViewMode::testNotAllowedView in tests/protected_node.view_mode.test
Test function.

File

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

Class

ProtectedNodeViewMode
Configure protected_node to use per node password.

Code

public function createPromotedProtectedNode($password) {

  // Add a new promoted page node that is protected.
  $node_title = $this
    ->randomName(8);
  $node_data = array(
    'title' => $node_title,
    'body[und][0][value]' => $this
      ->randomName(32),
    'protected_node_is_protected' => TRUE,
    'protected_node_passwd[pass1]' => $password,
    'protected_node_passwd[pass2]' => $password,
    'promote' => TRUE,
  );
  $this
    ->drupalPost('node/add/page', $node_data, t('Save'));
  return $this
    ->drupalGetNodeByTitle($node_title);
}