You are here

protected function EntityPrintTest::setUp in Entity Print 8

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

src/Tests/EntityPrintTest.php, line 32

Class

EntityPrintTest
Entity Print tests.

Namespace

Drupal\entity_print\Tests

Code

protected function setUp() {
  parent::setUp();

  // We revoke the access content permission because we use that to test our
  // permissions around entity view.
  user_role_revoke_permissions(AccountInterface::ANONYMOUS_ROLE, [
    'access content',
  ]);
  user_role_revoke_permissions(AccountInterface::AUTHENTICATED_ROLE, [
    'access content',
  ]);

  // Create a content type and a dummy node.
  $this
    ->drupalCreateContentType(array(
    'type' => 'page',
    'name' => 'Page',
  ));
  $this->node = $this
    ->drupalCreateNode();

  // Install our custom theme.
  $theme = 'entity_print_test_theme';
  \Drupal::service('theme_handler')
    ->install([
    $theme,
  ]);
  $this
    ->config('system.theme')
    ->set('default', $theme)
    ->save();
}