function WorkspaceTest::doTestWorkspaceOwner
Same name and namespace in other branches
- main core/modules/workspaces/tests/src/Functional/WorkspaceTest.php \Drupal\Tests\workspaces\Functional\WorkspaceTest::doTestWorkspaceOwner()
Tests changing the owner of a workspace.
1 call to WorkspaceTest::doTestWorkspaceOwner()
- WorkspaceTest::testWorkspaces in core/
modules/ workspaces/ tests/ src/ Functional/ WorkspaceTest.php - Test workspace functionality.
File
-
core/
modules/ workspaces/ tests/ src/ Functional/ WorkspaceTest.php, line 149
Class
- WorkspaceTest
- Test the workspace entity.
Namespace
Drupal\Tests\workspaces\FunctionalCode
protected function doTestWorkspaceOwner() : void {
$this->drupalGet('/admin/config/workflow/workspaces/add');
$this->submitForm([
'id' => 'test_workspace_2',
'label' => 'Test workspace',
], 'Save');
$storage = \Drupal::entityTypeManager()->getStorage('workspace');
$test_workspace = $storage->load('test_workspace_2');
$this->assertEquals($this->editor1
->id(), $test_workspace->getOwnerId());
$this->drupalGet('/admin/config/workflow/workspaces/manage/test_workspace_2/edit');
$this->submitForm([
'uid[0][target_id]' => $this->editor2
->getAccountName(),
], 'Save');
$test_workspace = $storage->loadUnchanged('test_workspace_2');
$this->assertEquals($this->editor2
->id(), $test_workspace->getOwnerId());
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.