function WorkspaceTestTrait::createWorkspaceHierarchy

Same name and namespace in other branches
  1. 9 core/modules/workspaces/tests/src/Kernel/WorkspaceTestTrait.php \Drupal\Tests\workspaces\Kernel\WorkspaceTestTrait::createWorkspaceHierarchy()
  2. 10 core/modules/workspaces/tests/src/Kernel/WorkspaceTestTrait.php \Drupal\Tests\workspaces\Kernel\WorkspaceTestTrait::createWorkspaceHierarchy()
  3. 11.x core/modules/workspaces/tests/src/Kernel/WorkspaceTestTrait.php \Drupal\Tests\workspaces\Kernel\WorkspaceTestTrait::createWorkspaceHierarchy()

Creates the following workspace hierarchy: 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 76

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();
}

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