public function ProtectedNodeStatistics::testGlobalNodePassword in Protected Node 7
Same name and namespace in other branches
- 1.0.x tests/protected_node.statistics.test \ProtectedNodeStatistics::testGlobalNodePassword()
Test function.
Test the total number of nodes protected by global/node passwords.
File
- tests/
protected_node.statistics.test, line 127 - Test protected node statistics overview.
Class
- ProtectedNodeStatistics
- Test protected node statistics overview.
Code
public function testGlobalNodePassword() {
// Add a new page node that is protected by the global password.
$node_data = array(
'title' => $this
->randomName(8),
'body[und][0][value]' => $this
->randomName(32),
'protected_node_is_protected' => TRUE,
);
$this
->drupalPost('node/add/page', $node_data, t('Save'));
// Add a new page node that is protected by a node password.
$password = $this
->randomName(8);
$node_data = array(
'title' => $this
->randomName(8),
'body[und][0][value]' => $this
->randomName(32),
'protected_node_is_protected' => TRUE,
'protected_node_passwd[pass1]' => $password,
'protected_node_passwd[pass2]' => $password,
);
$this
->drupalPost('node/add/page', $node_data, t('Save'));
// Go to the configuration page.
$this
->drupalGet('admin/config/content/protected_node');
$this
->assertRaw('<td>Total nodes</td><td style="text-align:right">2</td>', 'The total number of nodes is right.');
$this
->assertRaw('<td>Unprotected nodes</td><td style="text-align:right">0</td>', 'The total number of unprotected nodes is right.');
$this
->assertRaw('<td>Protected nodes</td><td style="text-align:right">2</td>', 'The total number of protected nodes is right.');
$this
->assertRaw('<td>Global passwords</td><td style="text-align:right">1</td>', 'The total number of nodes protected by a global password is right.');
$this
->assertRaw('<td>Node passwords</td><td style="text-align:right">1</td>', 'The total number of nodes protected by a node password is right.');
}