You are here

protected function CartEntityAccessTest::switchSession in Commerce Core 8.2

Switches to a different session.

Parameters

string $name: The name of the session to switch to.

3 calls to CartEntityAccessTest::switchSession()
CartEntityAccessTest::testAdministrativeAccess in modules/cart/tests/src/Functional/CartEntityAccessTest.php
Tests that cart access does not grant administrative access.
CartEntityAccessTest::testViewAccess in modules/cart/tests/src/Functional/CartEntityAccessTest.php
Tests that users with the view permission can view their own carts.
CartEntityAccessTest::testViewAccessWithoutViewPermission in modules/cart/tests/src/Functional/CartEntityAccessTest.php
Tests order view access without a "view own commerce_order" permission.

File

modules/cart/tests/src/Functional/CartEntityAccessTest.php, line 228

Class

CartEntityAccessTest
Tests cart access.

Namespace

Drupal\Tests\commerce_cart\Functional

Code

protected function switchSession($name) {
  $create_session = !$this->mink
    ->hasSession($name);
  if ($create_session) {
    $this->mink
      ->registerSession($name, new Session(new GoutteDriver()));
  }
  $this->mink
    ->setDefaultSessionName($name);
  if ($create_session) {

    // Visit the front page to initialise the session.
    $this
      ->initFrontPage();
  }
}