You are here

public function SessionTestSubscriber::onKernelRequestSessionTest in Drupal 9

Same name and namespace in other branches
  1. 8 core/modules/system/tests/modules/session_test/src/EventSubscriber/SessionTestSubscriber.php \Drupal\session_test\EventSubscriber\SessionTestSubscriber::onKernelRequestSessionTest()
  2. 10 core/modules/system/tests/modules/session_test/src/EventSubscriber/SessionTestSubscriber.php \Drupal\session_test\EventSubscriber\SessionTestSubscriber::onKernelRequestSessionTest()

Set header for session testing.

Parameters

\Symfony\Component\HttpKernel\Event\RequestEvent $event: The Event to process.

File

core/modules/system/tests/modules/session_test/src/EventSubscriber/SessionTestSubscriber.php, line 28

Class

SessionTestSubscriber
Defines a test session subscriber that checks whether the session is empty.

Namespace

Drupal\session_test\EventSubscriber

Code

public function onKernelRequestSessionTest(RequestEvent $event) {
  $session = $event
    ->getRequest()
    ->getSession();
  $this->emptySession = (int) (!($session && $session
    ->start()));
}