protected function WorkspaceTestTrait::switchToWorkspace in Drupal 8
Same name and namespace in other branches
- 9 core/modules/workspaces/tests/src/Kernel/WorkspaceTestTrait.php \Drupal\Tests\workspaces\Kernel\WorkspaceTestTrait::switchToWorkspace()
- 10 core/modules/workspaces/tests/src/Kernel/WorkspaceTestTrait.php \Drupal\Tests\workspaces\Kernel\WorkspaceTestTrait::switchToWorkspace()
Sets a given workspace as active.
Parameters
string $workspace_id: The ID of the workspace to switch to.
15 calls to WorkspaceTestTrait::switchToWorkspace()
- EntityReferenceSupportedNewEntitiesConstraintValidatorTest::testNewEntitiesForbiddenInNonDefaultWorkspace in core/
modules/ workspaces/ tests/ src/ Kernel/ EntityReferenceSupportedNewEntitiesConstraintValidatorTest.php - @covers ::validate
- WorkspaceIntegrationTest::assertWorkspaceStatus in core/
modules/ workspaces/ tests/ src/ Kernel/ WorkspaceIntegrationTest.php - Checks entity load, entity queries and views results for a test scenario.
- WorkspaceIntegrationTest::testDisallowedEntityCreateInNonDefaultWorkspace in core/
modules/ workspaces/ tests/ src/ Kernel/ WorkspaceIntegrationTest.php - Tests CREATE operations for unsupported entity types.
- WorkspaceIntegrationTest::testDisallowedEntityDeleteInNonDefaultWorkspace in core/
modules/ workspaces/ tests/ src/ Kernel/ WorkspaceIntegrationTest.php - Tests DELETE operations for unsupported entity types.
- WorkspaceIntegrationTest::testDisallowedEntityUpdateInNonDefaultWorkspace in core/
modules/ workspaces/ tests/ src/ Kernel/ WorkspaceIntegrationTest.php - Tests UPDATE operations for unsupported entity types.
File
- core/
modules/ workspaces/ tests/ src/ Kernel/ WorkspaceTestTrait.php, line 61
Class
- WorkspaceTestTrait
- A trait with common workspaces testing functionality.
Namespace
Drupal\Tests\workspaces\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('workspaces.manager')
->setActiveWorkspace($workspace);
}