You are here

protected function WorkspaceTestTrait::createWorkspaceHierarchy in Drupal 9

Same name and namespace in other branches
  1. 8 core/modules/workspaces/tests/src/Kernel/WorkspaceTestTrait.php \Drupal\Tests\workspaces\Kernel\WorkspaceTestTrait::createWorkspaceHierarchy()

Creates a test workspace hierarchy.

The full hierarchy including the default workspaces 'live' and 'stage' is:

live

  • stage

    • dev

      • local_1
      • local_2
  • qa
2 calls to WorkspaceTestTrait::createWorkspaceHierarchy()
WorkspaceIntegrationTest::testWorkspaceHierarchy in core/modules/workspaces/tests/src/Kernel/WorkspaceIntegrationTest.php
Tests entity tracking in workspace descendants.
WorkspaceMergerTest::testWorkspaceMerger in core/modules/workspaces/tests/src/Kernel/WorkspaceMergerTest.php
Tests workspace merging.

File

core/modules/workspaces/tests/src/Kernel/WorkspaceTestTrait.php, line 79

Class

WorkspaceTestTrait
A trait with common workspaces testing functionality.

Namespace

Drupal\Tests\workspaces\Kernel

Code

protected function createWorkspaceHierarchy() {
  $this->workspaces['dev'] = Workspace::create([
    'id' => 'dev',
    'parent' => 'stage',
  ]);
  $this->workspaces['dev']
    ->save();
  $this->workspaces['local_1'] = Workspace::create([
    'id' => 'local_1',
    'parent' => 'dev',
  ]);
  $this->workspaces['local_1']
    ->save();
  $this->workspaces['local_2'] = Workspace::create([
    'id' => 'local_2',
    'parent' => 'dev',
  ]);
  $this->workspaces['local_2']
    ->save();
  $this->workspaces['qa'] = Workspace::create([
    'id' => 'qa',
    'parent' => 'live',
  ]);
  $this->workspaces['qa']
    ->save();
}