public function ProtectedNodeGlobalPassword::testAllowedView in Protected Node 1.0.x
Same name and namespace in other branches
- 7 tests/protected_node.global.test \ProtectedNodeGlobalPassword::testAllowedView()
Test function.
Test that a node protected with global protection can be seen with the right password.
File
- tests/
protected_node.global.test, line 59 - Test protected node global password functionality.
Class
- ProtectedNodeGlobalPassword
- Configure protected_node to use global password.
Code
public function testAllowedView() {
// 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);
$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);
}