Tests the book navigation block when an access module is enabled.
function testNavigationBlockOnAccessModuleEnabled() {
$this
->drupalLogin($this->admin_user);
$block = $this
->drupalPlaceBlock('book_navigation', array(
'block_mode' => 'book pages',
));
// 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.");
// Create a book.
$this
->createBook();
// Test correct display of the block to registered users.
$this
->drupalLogin($this->web_user);
$this
->drupalGet('node/' . $this->book->nid);
$this
->assertText($block
->label(), 'Book navigation block is displayed to registered users.');
$this
->drupalLogout();
// Test correct display of the block to anonymous users.
$this
->drupalGet('node/' . $this->book->nid);
$this
->assertText($block
->label(), 'Book navigation block is displayed to anonymous users.');
// Test the 'book pages' block_mode setting.
$this
->drupalGet('<front>');
$this
->assertNoText($block
->label(), 'Book navigation block is not shown on non-book pages.');
}