You are here

public function SessionTest::assertSessionEmpty in Drupal 10

Same name and namespace in other branches
  1. 8 core/modules/system/tests/src/Functional/Session/SessionTest.php \Drupal\Tests\system\Functional\Session\SessionTest::assertSessionEmpty()
  2. 9 core/modules/system/tests/src/Functional/Session/SessionTest.php \Drupal\Tests\system\Functional\Session\SessionTest::assertSessionEmpty()

Assert whether $_SESSION is empty at the beginning of the request.

@internal

2 calls to SessionTest::assertSessionEmpty()
SessionTest::testEmptyAnonymousSession in core/modules/system/tests/src/Functional/Session/SessionTest.php
Tests that empty anonymous sessions are destroyed.
SessionTest::testSessionBag in core/modules/system/tests/src/Functional/Session/SessionTest.php
Tests session bag.

File

core/modules/system/tests/src/Functional/Session/SessionTest.php, line 390

Class

SessionTest
Drupal session handling tests.

Namespace

Drupal\Tests\system\Functional\Session

Code

public function assertSessionEmpty(bool $empty) : void {
  if ($empty) {
    $this
      ->assertSession()
      ->responseHeaderEquals('X-Session-Empty', '1');
  }
  else {
    $this
      ->assertSession()
      ->responseHeaderEquals('X-Session-Empty', '0');
  }
}