Tests the functionality of the book navigation block.
function testBookNavigationBlock() {
$this
->drupalLogin($this->admin_user);
// Enable the block.
$block = $this
->drupalPlaceBlock('book_navigation');
// Give anonymous users the permission 'node test view'.
$edit = array();
$edit[DRUPAL_ANONYMOUS_RID . '[node test view]'] = TRUE;
$this
->drupalPost('admin/people/permissions/' . DRUPAL_ANONYMOUS_RID, $edit, t('Save permissions'));
$this
->assertText(t('The changes have been saved.'), "Permission 'node test view' successfully assigned to anonymous users.");
// Test correct display of the block.
$nodes = $this
->createBook();
$this
->drupalGet('<front>');
$this
->assertText($block
->label(), 'Book navigation block is displayed.');
$this
->assertText($this->book
->label(), format_string('Link to book root (@title) is displayed.', array(
'@title' => $nodes[0]
->label(),
)));
$this
->assertNoText($nodes[0]
->label(), 'No links to individual book pages are displayed.');
}