You are here

protected function BookTest::setUp in Zircon Profile 8.0

Same name in this branch
  1. 8.0 core/modules/book/src/Tests/BookTest.php \Drupal\book\Tests\BookTest::setUp()
  2. 8.0 core/modules/book/tests/src/Unit/Plugin/migrate/source/d6/BookTest.php \Drupal\Tests\book\Unit\Plugin\migrate\source\d6\BookTest::setUp()
Same name and namespace in other branches
  1. 8 core/modules/book/src/Tests/BookTest.php \Drupal\book\Tests\BookTest::setUp()

Sets up a Drupal site for running functional and integration tests.

Installs Drupal with the installation profile specified in \Drupal\simpletest\WebTestBase::$profile into the prefixed database.

Afterwards, installs any additional modules specified in the static \Drupal\simpletest\WebTestBase::$modules property of each class in the class hierarchy.

After installation all caches are flushed and several configuration values are reset to the values of the parent site executing the test, since the default values may be incompatible with the environment in which tests are being executed.

Overrides WebTestBase::setUp

File

core/modules/book/src/Tests/BookTest.php, line 68
Contains \Drupal\book\Tests\BookTest.

Class

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

Namespace

Drupal\book\Tests

Code

protected function setUp() {
  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(array(
    'create new books',
    'create book content',
    'edit own book content',
    'add content to books',
  ));
  $this->webUser = $this
    ->drupalCreateUser(array(
    'access printer-friendly version',
    'node test view',
  ));
  $this->webUserWithoutNodeAccess = $this
    ->drupalCreateUser(array(
    'access printer-friendly version',
  ));
  $this->adminUser = $this
    ->drupalCreateUser(array(
    'create new books',
    'create book content',
    'edit own book content',
    'add content to books',
    'administer blocks',
    'administer permissions',
    'administer book outlines',
    'node test view',
    'administer content types',
    'administer site configuration',
  ));
}