You are here

public function ProtectedNodeMail::createProtectedNode in Protected Node 7

Same name and namespace in other branches
  1. 1.0.x tests/protected_node.mail_test.test \ProtectedNodeMail::createProtectedNode()

Helper method to create a protected node.

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

Parameters

string $password: A password.

string $to: An email recipient.

Return value

object A node object.

2 calls to ProtectedNodeMail::createProtectedNode()
ProtectedNodeMail::testRandomPassword in tests/protected_node.mail_test.test
Test that a random password is created and saved when sending an email.
ProtectedNodeMail::testSendMail in tests/protected_node.mail_test.test
Test that a mail is send when a protected node is created.

File

tests/protected_node.mail_test.test, line 109
Test protected node email functionality.

Class

ProtectedNodeMail
Configure protected_node to send email.

Code

public function createProtectedNode($password, $to) {

  // Add a new 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,
    'protected_node_emails' => $to,
  );
  $this
    ->drupalPost('node/add/page', $node_data, t('Save'));
  return $this
    ->drupalGetNodeByTitle($node_title);
}