You are here

protected function SessionTestTrait::generateSessionName in Drupal 8

Same name and namespace in other branches
  1. 9 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);
}