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. 10 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.

5 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
Test editing a node in multiple workspaces.
WorkspaceContentModerationIntegrationTest::setUp in core/modules/content_moderation/tests/src/Functional/WorkspaceContentModerationIntegrationTest.php
Sets the test up.
WorkspaceSwitcherTest::setUp in core/modules/workspaces/tests/src/Functional/WorkspaceSwitcherTest.php

File

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

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' => 'workspaceswitcher',
        'region' => 'sidebar_first',
        'label' => 'Workspace switcher',
    ]);
    // Confirm the block shows on the front page.
    $this->drupalGet('<front>');
    $page = $this->getSession()
        ->getPage();
    $this->assertTrue($page->hasContent('Workspace switcher'));
}

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