public function ProtectedNodePerTypePassword::testAllowedViewWrongPassword in Protected Node 7
Same name and namespace in other branches
- 1.0.x tests/protected_node.per_type.test \ProtectedNodePerTypePassword::testAllowedViewWrongPassword()
Test function.
Test that a node protected with per type protection can't be seen with the wrong password.
File
- tests/
protected_node.per_type.test, line 90 - Test protected node per type functionality.
Class
- ProtectedNodePerTypePassword
- Configure protected_node to use per type password.
Code
public function testAllowedViewWrongPassword() {
// Generate a protected node.
$node = $this
->adminCreateProtectedNode();
// An authenticated user is viewing the node.
$this
->drupalLogin($this->normalAccessAllowedUser);
$another_password = $this
->randomName(14);
$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);
}