// Load the book and verify there is no printer-friendly version link.
$this->
drupalGet('node/' .
$this->book->
id());
$this->
assertSession()->
linkNotExists('Printer-friendly version', 'Anonymous user is not shown link to printer-friendly version.'
);
// Try getting the URL directly, and verify it fails.
$this->
drupalGet('book/export/html/' .
$this->book->
id());
$this->
assertSession()->
statusCodeEquals(403
);
// Now grant anonymous users permission to view the printer-friendly
// version and verify that node access restrictions still prevent them from
// seeing it.
user_role_grant_permissions(RoleInterface::ANONYMOUS_ID,
['access printer-friendly version'
]);
$this->
drupalGet('book/export/html/' .
$this->book->
id());
$this->
assertSession()->
statusCodeEquals(403
);
} /**
* Tests the functionality of the book navigation block.
*/
public function testBookNavigationBlock() { $this->
drupalLogin($this->adminUser
);
// Enable the block.