You are here

protected function WorkspaceTestUtilities::createWorkspaceThroughUi in Workspace 8.2

Same name and namespace in other branches
  1. 8 tests/src/Functional/WorkspaceTestUtilities.php \Drupal\Tests\workspace\Functional\WorkspaceTestUtilities::createWorkspaceThroughUI()

Creates a new Workspace through the UI.

Parameters

string $label: The label of the workspace to create.

string $id: The ID of the workspace to create.

Return value

\Drupal\workspace\WorkspaceInterface The workspace that was just created.

11 calls to WorkspaceTestUtilities::createWorkspaceThroughUi()
WorkspaceBypassTest::testBypassOwnWorkspace in tests/src/Functional/WorkspaceBypassTest.php
Verifies that a user can edit anything in a workspace they own.
WorkspaceConcurrentEditingTest::testSwitchingWorkspaces in tests/src/Functional/WorkspaceConcurrentEditingTest.php
Test switching workspace via the switcher block and admin page.
WorkspacePermissionsTest::testCreateWorkspace in tests/src/Functional/WorkspacePermissionsTest.php
Verifies that a user can create but not edit a workspace.
WorkspacePermissionsTest::testDeleteAnyWorkspace in tests/src/Functional/WorkspacePermissionsTest.php
Verifies that a user can delete any workspace.
WorkspacePermissionsTest::testDeleteOwnWorkspace in tests/src/Functional/WorkspacePermissionsTest.php
Verifies that a user can create and delete only their own workspace.

... See full list

File

tests/src/Functional/WorkspaceTestUtilities.php, line 56

Class

WorkspaceTestUtilities
Utility methods for use in BrowserTestBase tests.

Namespace

Drupal\Tests\workspace\Functional

Code

protected function createWorkspaceThroughUi($label, $id) {
  $this
    ->drupalPostForm('/admin/config/workflow/workspace/add', [
    'id' => $id,
    'label' => $label,
  ], 'Save');
  $this
    ->getSession()
    ->getPage()
    ->hasContent("{$label} ({$id})");
  return Workspace::load($id);
}