function SessionTestSubscriber::onKernelResponseSessionTest

Same name in other branches
  1. 9 core/modules/system/tests/modules/session_test/src/EventSubscriber/SessionTestSubscriber.php \Drupal\session_test\EventSubscriber\SessionTestSubscriber::onKernelResponseSessionTest()
  2. 8.9.x core/modules/system/tests/modules/session_test/src/EventSubscriber/SessionTestSubscriber.php \Drupal\session_test\EventSubscriber\SessionTestSubscriber::onKernelResponseSessionTest()
  3. 11.x core/modules/system/tests/modules/session_test/src/EventSubscriber/SessionTestSubscriber.php \Drupal\session_test\EventSubscriber\SessionTestSubscriber::onKernelResponseSessionTest()

Performs tasks for session_test module on kernel.response.

Parameters

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

File

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

Class

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

Namespace

Drupal\session_test\EventSubscriber

Code

public function onKernelResponseSessionTest(ResponseEvent $event) {
    // Set header for session testing.
    $response = $event->getResponse();
    $response->headers
        ->set('X-Session-Empty', $this->emptySession ? '1' : '0');
}

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