function SessionTestTrait::generateSessionName

Same name and namespace in other branches
  1. 8.9.x core/tests/Drupal/Tests/SessionTestTrait.php \Drupal\Tests\SessionTestTrait::generateSessionName()
  2. 10 core/tests/Drupal/Tests/SessionTestTrait.php \Drupal\Tests\SessionTestTrait::generateSessionName()
  3. 11.x core/tests/Drupal/Tests/SessionTestTrait.php \Drupal\Tests\SessionTestTrait::generateSessionName()

Generates a session cookie name.

Parameters

string $data: The data to generate session name.

1 call to SessionTestTrait::generateSessionName()
FunctionalTestSetupTrait::initUserSession in core/lib/Drupal/Core/Test/FunctionalTestSetupTrait.php
Initializes user 1 for the site to be installed.

File

core/tests/Drupal/Tests/SessionTestTrait.php, line 25

Class

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

Namespace

Drupal\Tests

Code

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

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