function WorkspaceTest::testWorkspaceOwner
Same name in other branches
- 9 core/modules/workspaces/tests/src/Functional/WorkspaceTest.php \Drupal\Tests\workspaces\Functional\WorkspaceTest::testWorkspaceOwner()
- 8.9.x core/modules/workspaces/tests/src/Functional/WorkspaceTest.php \Drupal\Tests\workspaces\Functional\WorkspaceTest::testWorkspaceOwner()
- 10 core/modules/workspaces/tests/src/Functional/WorkspaceTest.php \Drupal\Tests\workspaces\Functional\WorkspaceTest::testWorkspaceOwner()
Tests changing the owner of a workspace.
File
-
core/
modules/ workspaces/ tests/ src/ Functional/ WorkspaceTest.php, line 133
Class
- WorkspaceTest
- Test the workspace entity.
Namespace
Drupal\Tests\workspaces\FunctionalCode
public function testWorkspaceOwner() : void {
$this->drupalLogin($this->editor1);
$this->drupalGet('/admin/config/workflow/workspaces/add');
$this->submitForm([
'id' => 'test_workspace',
'label' => 'Test workspace',
], 'Save');
$storage = \Drupal::entityTypeManager()->getStorage('workspace');
$test_workspace = $storage->load('test_workspace');
$this->assertEquals($this->editor1
->id(), $test_workspace->getOwnerId());
$this->drupalGet('/admin/config/workflow/workspaces/manage/test_workspace/edit');
$this->submitForm([
'uid[0][target_id]' => $this->editor2
->getAccountName(),
], 'Save');
$test_workspace = $storage->loadUnchanged('test_workspace');
$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.