You are here

protected function WorkspaceIntegrationTest::initializeWorkspaceModule in Workspace 8.2

Enables the Workspace module and creates two workspaces.

2 calls to WorkspaceIntegrationTest::initializeWorkspaceModule()
WorkspaceIntegrationTest::testEntityQueryRelationship in tests/src/Kernel/WorkspaceIntegrationTest.php
Tests the Entity Query relationship API with workspaces.
WorkspaceIntegrationTest::testWorkspaces in tests/src/Kernel/WorkspaceIntegrationTest.php
Tests various scenarios for creating and deploying content in workspaces.

File

tests/src/Kernel/WorkspaceIntegrationTest.php, line 94

Class

WorkspaceIntegrationTest
Tests a complete deployment scenario across different workspaces.

Namespace

Drupal\Tests\workspace\Kernel

Code

protected function initializeWorkspaceModule() {

  // Enable the Workspace module here instead of the static::$modules array so
  // we can test it with default content.
  $this
    ->enableModules([
    'workspace',
  ]);
  $this->container = \Drupal::getContainer();
  $this->entityTypeManager = \Drupal::entityTypeManager();
  $this
    ->installEntitySchema('workspace');
  $this
    ->installEntitySchema('workspace_association');

  // Create two workspaces by default, 'live' and 'stage'.
  $this->workspaces['live'] = Workspace::create([
    'id' => 'live',
  ]);
  $this->workspaces['live']
    ->save();
  $this->workspaces['stage'] = Workspace::create([
    'id' => 'stage',
    'target' => 'live',
  ]);
  $this->workspaces['stage']
    ->save();
  $permissions = [
    'administer nodes',
    'create workspace',
    'edit any workspace',
    'view any workspace',
  ];
  $this
    ->setCurrentUser($this
    ->createUser($permissions));
}