function BookTest::setUp

Same name in other branches
  1. 9 core/modules/book/tests/src/Functional/BookTest.php \Drupal\Tests\book\Functional\BookTest::setUp()
  2. 8.9.x core/modules/book/tests/src/Functional/BookTest.php \Drupal\Tests\book\Functional\BookTest::setUp()
  3. 10 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 63

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',
    ]);
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.