function WorkspaceTestUtilities::setupWorkspaceSwitcherBlock

Same name in other branches
  1. 9 core/modules/workspaces/tests/src/Functional/WorkspaceTestUtilities.php \Drupal\Tests\workspaces\Functional\WorkspaceTestUtilities::setupWorkspaceSwitcherBlock()
  2. 8.9.x core/modules/workspaces/tests/src/Functional/WorkspaceTestUtilities.php \Drupal\Tests\workspaces\Functional\WorkspaceTestUtilities::setupWorkspaceSwitcherBlock()
  3. 11.x core/modules/workspaces/tests/src/Functional/WorkspaceTestUtilities.php \Drupal\Tests\workspaces\Functional\WorkspaceTestUtilities::setupWorkspaceSwitcherBlock()

Adds the workspace switcher block to the site.

This is necessary for switchToWorkspace() to function correctly.

10 calls to WorkspaceTestUtilities::setupWorkspaceSwitcherBlock()
PathWorkspacesTest::setUp in core/modules/workspaces/tests/src/Functional/PathWorkspacesTest.php
WorkspaceBypassTest::testBypassOwnWorkspace in core/modules/workspaces/tests/src/Functional/WorkspaceBypassTest.php
Verifies that a user can edit anything in a workspace they own.
WorkspaceConcurrentEditingTest::testConcurrentEditing in core/modules/workspaces/tests/src/Functional/WorkspaceConcurrentEditingTest.php
Tests editing a node in multiple workspaces.
WorkspaceContentModerationIntegrationTest::setUp in core/modules/content_moderation/tests/src/Functional/WorkspaceContentModerationIntegrationTest.php
Sets the test up.
WorkspaceEntityDeleteTest::setUp in core/modules/workspaces/tests/src/Functional/WorkspaceEntityDeleteTest.php

... See full list

File

core/modules/workspaces/tests/src/Functional/WorkspaceTestUtilities.php, line 107

Class

WorkspaceTestUtilities
Utility methods for use in BrowserTestBase tests.

Namespace

Drupal\Tests\workspaces\Functional

Code

protected function setupWorkspaceSwitcherBlock() {
    // Add the block to the sidebar.
    $this->placeBlock('workspace_switcher', [
        'id' => 'workspace_switcher',
        'region' => 'sidebar_first',
        'label' => 'Workspace switcher',
    ]);
    $this->drupalGet('<front>');
    $this->switcherBlockConfigured = TRUE;
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.