function WorkspaceTestUtilities::switchToLive

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

Switches to the live version of the site for subsequent requests.

This assumes that the switcher block has already been setup by calling setupWorkspaceSwitcherBlock().

9 calls to WorkspaceTestUtilities::switchToLive()
PathWorkspacesTest::testPathAliases in core/modules/workspaces/tests/src/Functional/PathWorkspacesTest.php
Tests path aliases with workspaces.
PathWorkspacesTest::testPathAliasesWithTranslation in core/modules/workspaces/tests/src/Functional/PathWorkspacesTest.php
Tests path aliases with workspaces for translatable nodes.
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::testModerationInWorkspace in core/modules/content_moderation/tests/src/Functional/WorkspaceContentModerationIntegrationTest.php
Tests moderating nodes in a workspace.

... See full list

File

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

Class

WorkspaceTestUtilities
Utility methods for use in BrowserTestBase tests.

Namespace

Drupal\Tests\workspaces\Functional

Code

protected function switchToLive() {
    
    /** @var \Drupal\Tests\WebAssert $session */
    $session = $this->assertSession();
    $this->submitForm([], 'Switch to Live');
    $session->pageTextContains('You are now viewing the live version of the site.');
    // Keep the test runner in sync with the system under test.
    \Drupal::service('workspaces.manager')->switchToLive();
}

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