public function ProtectedNodeGlobalPassword::testAllowedViewWrongPassword in Protected Node 7
Same name and namespace in other branches
- 1.0.x tests/protected_node.global.test \ProtectedNodeGlobalPassword::testAllowedViewWrongPassword()
Test function.
Test that a node protected with global protection can't be seen with the wrong password.
File
- tests/
protected_node.global.test, line 82 - Test protected node global password functionality.
Class
- ProtectedNodeGlobalPassword
- Configure protected_node to use global password.
Code
public function testAllowedViewWrongPassword() {
// Log in as Admin.
$this
->drupalLogin($this->adminUser);
// Create a new page node.
$node = $this
->createProtectedNode();
// Once the node created logout the user.
$this
->drupalLogout();
// An authenticated user sees the node.
$this
->drupalLogin($this->normalAccessAllowedUser);
$another_password = $this
->randomName(12);
$form = array(
'password' => $another_password,
);
$this
->drupalPost('node/' . $node->nid, $form, t('OK'));
$text = $node->body[LANGUAGE_NONE][0]['value'];
$this
->assertNoText($text, "User with right permission can't access a protected node with wrong password", $this->group);
}