function WorkspaceQueryParameterNegotiatorTest::setUp

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

Overrides KernelTestBase::setUp

File

core/modules/workspaces/tests/src/Kernel/WorkspaceQueryParameterNegotiatorTest.php, line 34

Class

WorkspaceQueryParameterNegotiatorTest
Tests the query parameter workspace negotiator.

Namespace

Drupal\Tests\workspaces\Kernel

Code

protected function setUp() : void {
    parent::setUp();
    $this->installEntitySchema('user');
    $this->installEntitySchema('workspace');
    $this->installSchema('workspaces', [
        'workspace_association',
    ]);
    // Create a new workspace for testing.
    Workspace::create([
        'id' => 'stage',
        'label' => 'Stage',
    ])->save();
    $this->setCurrentUser($this->createUser([
        'administer workspaces',
    ]));
    // Reset the internal state of the workspace manager so that checking for an
    // active workspace in the test is not influenced by previous actions.
    \Drupal::getContainer()->set('workspaces.manager', NULL);
}

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