You are here

protected function SessionTestTrait::generateSessionName in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/modules/simpletest/src/SessionTestTrait.php \Drupal\simpletest\SessionTestTrait::generateSessionName()

Generates a session cookie name.

Parameters

string $data: The data to generate session name.

2 calls to SessionTestTrait::generateSessionName()
BrowserTestBase::installDrupal in core/modules/simpletest/src/BrowserTestBase.php
Installs Drupal into the Simpletest site.
WebTestBase::initUserSession in core/modules/simpletest/src/WebTestBase.php
Initializes user 1 for the site to be installed.

File

core/modules/simpletest/src/SessionTestTrait.php, line 30
Contains \Drupal\simpletest\SessionTestTrait.

Class

SessionTestTrait
Provides methods to generate and get session name in tests.

Namespace

Drupal\simpletest

Code

protected function generateSessionName($data) {
  $prefix = Request::createFromGlobals()
    ->isSecure() ? 'SSESS' : 'SESS';
  $this->sessionName = $prefix . substr(hash('sha256', $data), 0, 32);
}