You are here

protected function WorkspaceTestUtilities::setupWorkspaceSwitcherBlock in Drupal 9

Same name and namespace in other branches
  1. 8 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.

7 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.
WorkspaceSwitcherTest::setUp in core/modules/workspaces/tests/src/Functional/WorkspaceSwitcherTest.php

... See full list

File

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

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'));
  $this->switcher_block_configured = TRUE;
}