You are here

protected function WorkspaceTestUtilities::setupWorkspaceSwitcherBlock in Workspace 8

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

8 calls to WorkspaceTestUtilities::setupWorkspaceSwitcherBlock()
ReplicationSettingsTest::testPullReplicationSettings in tests/src/Functional/ReplicationSettingsTest.php
Verify pull replication settings using the published filter as an example.
ReplicationSettingsTest::testPushReplicationSettings in tests/src/Functional/ReplicationSettingsTest.php
Verify push replication settings using the published filter as an example.
ReplicatorAliasTest::setUp in tests/src/Functional/ReplicatorAliasTest.php
ReplicatorTest::setUp in tests/src/Functional/ReplicatorTest.php
WorkspaceBypassTest::testBypassOwnWorkspace in tests/src/Functional/WorkspaceBypassTest.php
Verifies that a user can edit anything in a workspace they own.

... See full list

File

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

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
    ->drupalPlaceBlock('workspace_switcher_block', [
    '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'));
}