function WorkspaceTestUtilities::switchToLive

Same name and namespace in other branches
  1. 11.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. 8.9.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().

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.