You are here

public function ProtectedNodeBulkPassword::testClearSessions in Protected Node 7

Same name and namespace in other branches
  1. 1.0.x tests/protected_node.bulk.test \ProtectedNodeBulkPassword::testClearSessions()

Test function.

Test that the password has to be re-entered after clearing the sessions.

File

tests/protected_node.bulk.test, line 48
Test protected node bulk actions functionality.

Class

ProtectedNodeBulkPassword
Configure protected_node to use mixin password.

Code

public function testClearSessions() {

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

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

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

  // An authenticated user sees the node.
  $this
    ->drupalLogin($this->normalAccessAllowedUser);
  $form = array(
    'password' => $this->global_password,
  );
  $this
    ->drupalPost('node/' . $node->nid, $form, t('OK'));
  $text = $node->body[LANGUAGE_NONE][0]['value'];
  $this
    ->assertText($text, "User with right permission can access a protected node with right password", $this->group);

  // Log in as Admin to clear sessions.
  $this
    ->drupalLogin($this->adminUser);
  $this
    ->drupalPost('admin/config/content/protected_node', array(), t('Clear sessions'));
  $this
    ->drupalLogout();

  // An authenticated user sees the node.
  $this
    ->drupalLogin($this->normalAccessAllowedUser);
  $this
    ->drupalGet('node/' . $node->nid);
  $text = 'Protected page -- Enter password';
  $this
    ->assertText($text, "User with right permission has to re-enter the password", $this->group);
}