You are here

protected function WorkspaceTestUtilities::setupWorkspaceSwitcherBlock in Workspace 8.2

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

Adds the workspace switcher block to the site.

This is necessary for switchToWorkspace() to function correctly.

3 calls to WorkspaceTestUtilities::setupWorkspaceSwitcherBlock()
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.
WorkspaceSwitcherTest::testSwitchingWorkspaces in tests/src/Functional/WorkspaceSwitcherTest.php
Test switching workspace via the switcher block and admin page.

File

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

Class

WorkspaceTestUtilities
Utility methods for use in BrowserTestBase tests.

Namespace

Drupal\Tests\workspace\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'));
}