function WorkspaceSwitcherTest::testSwitchingWorkspaces

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

Tests switching workspace via the switcher block and admin page.

File

core/modules/workspaces/tests/src/Functional/WorkspaceSwitcherTest.php, line 50

Class

WorkspaceSwitcherTest
Tests workspace switching functionality.

Namespace

Drupal\Tests\workspaces\Functional

Code

public function testSwitchingWorkspaces() {
    $vultures = $this->createWorkspaceThroughUi('Vultures', 'vultures');
    $this->switchToWorkspace($vultures);
    $gravity = $this->createWorkspaceThroughUi('Gravity', 'gravity');
    $this->drupalGet('/admin/config/workflow/workspaces/manage/' . $gravity->id() . '/activate');
    $this->assertSession()
        ->statusCodeEquals(200);
    $page = $this->getSession()
        ->getPage();
    $page->findButton('Confirm')
        ->click();
    // Check that WorkspaceCacheContext provides the cache context used to
    // support its functionality.
    $this->assertCacheContext('session');
    $page->findLink($gravity->label());
}

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