protected function WorkspaceIntegrationTest::switchToWorkspace in Workspace 8.2
Sets a given workspace as active.
Parameters
string $workspace_id: The ID of the workspace to switch to.
3 calls to WorkspaceIntegrationTest::switchToWorkspace()
- WorkspaceIntegrationTest::assertWorkspaceStatus in tests/
src/ Kernel/ WorkspaceIntegrationTest.php - Checks entity load, entity queries and views results for a test scenario.
- 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 644
Class
- WorkspaceIntegrationTest
- Tests a complete deployment scenario across different workspaces.
Namespace
Drupal\Tests\workspace\KernelCode
protected function switchToWorkspace($workspace_id) {
// Switch the test runner's context to the specified workspace.
$workspace = $this->entityTypeManager
->getStorage('workspace')
->load($workspace_id);
\Drupal::service('workspace.manager')
->setActiveWorkspace($workspace);
}