public function ProtectedNodeStatistics::testUnprotectedProtected in Protected Node 1.0.x
Same name and namespace in other branches
- 7 tests/protected_node.statistics.test \ProtectedNodeStatistics::testUnprotectedProtected()
Test function.
Test the total number of unprotected/protected nodes.
File
- tests/
protected_node.statistics.test, line 66 - Test protected node statistics overview.
Class
- ProtectedNodeStatistics
- Test protected node statistics overview.
Code
public function testUnprotectedProtected() {
// Add a new page node that is not protected.
$node_data = array(
'title' => $this
->randomName(8),
'body[und][0][value]' => $this
->randomName(32),
);
$this
->drupalPost('node/add/page', $node_data, t('Save'));
// Add a new page node that is protected.
$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'));
// 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">1</td>', 'The total number of unprotected nodes is right.');
$this
->assertRaw('<td>Protected nodes</td><td style="text-align:right">1</td>', 'The total number of protected nodes is right.');
}