trait SessionTestTrait in Zircon Profile 8
Same name and namespace in other branches
- 8.0 core/modules/simpletest/src/SessionTestTrait.php \Drupal\simpletest\SessionTestTrait
Provides methods to generate and get session name in tests.
Hierarchy
- trait \Drupal\simpletest\SessionTestTrait
File
- core/
modules/ simpletest/ src/ SessionTestTrait.php, line 15 - Contains \Drupal\simpletest\SessionTestTrait.
Namespace
Drupal\simpletestView source
trait SessionTestTrait {
/**
* The name of the session cookie.
*
* @var string
*/
protected $sessionName;
/**
* Generates a session cookie name.
*
* @param string $data
* The data to generate session name.
*/
protected function generateSessionName($data) {
$prefix = Request::createFromGlobals()
->isSecure() ? 'SSESS' : 'SESS';
$this->sessionName = $prefix . substr(hash('sha256', $data), 0, 32);
}
/**
* Returns the session name in use on the child site.
*
* @return string
* The name of the session cookie.
*/
protected function getSessionName() {
return $this->sessionName;
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
SessionTestTrait:: |
protected | property | The name of the session cookie. | |
SessionTestTrait:: |
protected | function | Generates a session cookie name. | |
SessionTestTrait:: |
protected | function | Returns the session name in use on the child site. |