You are here

protected function BookTest::setUp in Drupal 9

Same name and namespace in other branches
  1. 8 core/modules/book/tests/src/Functional/BookTest.php \Drupal\Tests\book\Functional\BookTest::setUp()

Overrides BrowserTestBase::setUp

File

core/modules/book/tests/src/Functional/BookTest.php, line 61

Class

BookTest
Create a book, add pages, and test book interface.

Namespace

Drupal\Tests\book\Functional

Code

protected function setUp() : void {
  parent::setUp();
  $this
    ->drupalPlaceBlock('system_breadcrumb_block');
  $this
    ->drupalPlaceBlock('page_title_block');

  // node_access_test requires a node_access_rebuild().
  node_access_rebuild();

  // Create users.
  $this->bookAuthor = $this
    ->drupalCreateUser([
    'create new books',
    'create book content',
    'edit own book content',
    'add content to books',
    'view own unpublished content',
  ]);
  $this->webUser = $this
    ->drupalCreateUser([
    'access printer-friendly version',
    'node test view',
  ]);
  $this->webUserWithoutNodeAccess = $this
    ->drupalCreateUser([
    'access printer-friendly version',
  ]);
  $this->adminUser = $this
    ->drupalCreateUser([
    'create new books',
    'create book content',
    'edit any book content',
    'delete any book content',
    'add content to books',
    'administer blocks',
    'administer permissions',
    'administer book outlines',
    'node test view',
    'administer content types',
    'administer site configuration',
    'view any unpublished content',
  ]);
}