function WorkspaceAssociationTest::setUp

Same name in other branches
  1. 10 core/modules/workspaces/tests/src/Kernel/WorkspaceAssociationTest.php \Drupal\Tests\workspaces\Kernel\WorkspaceAssociationTest::setUp()

Overrides KernelTestBase::setUp

File

core/modules/workspaces/tests/src/Kernel/WorkspaceAssociationTest.php, line 44

Class

WorkspaceAssociationTest
Tests workspace associations.

Namespace

Drupal\Tests\workspaces\Kernel

Code

protected function setUp() : void {
    parent::setUp();
    $this->entityTypeManager = \Drupal::entityTypeManager();
    $this->installEntitySchema('entity_test_mulrevpub');
    $this->installEntitySchema('entity_test_mulrevpub_string_id');
    $this->installEntitySchema('user');
    $this->installEntitySchema('workspace');
    $this->installConfig([
        'system',
    ]);
    $this->installSchema('workspaces', [
        'workspace_association',
    ]);
    $permissions = array_intersect([
        'administer nodes',
        'create workspace',
        'edit any workspace',
        'view any workspace',
    ], array_keys($this->container
        ->get('user.permissions')
        ->getPermissions()));
    $this->setCurrentUser($this->createUser($permissions));
    $this->workspaces['stage'] = Workspace::create([
        'id' => 'stage',
        'label' => 'Stage',
    ]);
    $this->workspaces['stage']
        ->save();
    $this->workspaces['dev'] = Workspace::create([
        'id' => 'dev',
        'parent' => 'stage',
        'label' => 'Dev',
    ]);
    $this->workspaces['dev']
        ->save();
}

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