function WorkspaceTestUtilities::switchToLive

Same name in other branches
  1. 8.9.x core/modules/workspaces/tests/src/Functional/WorkspaceTestUtilities.php \Drupal\Tests\workspaces\Functional\WorkspaceTestUtilities::switchToLive()
  2. 10 core/modules/workspaces/tests/src/Functional/WorkspaceTestUtilities.php \Drupal\Tests\workspaces\Functional\WorkspaceTestUtilities::switchToLive()
  3. 11.x 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().

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

File

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

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.');
}

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