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