function SessionTest::assertSessionEmpty

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

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

File

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

Class

SessionTest
Drupal session handling tests.

Namespace

Drupal\Tests\system\Functional\Session

Code

public function assertSessionEmpty($empty) {
  if ($empty) {
    $this->assertIdentical($this->drupalGetHeader('X-Session-Empty'), '1', 'Session was empty.');
  }
  else {
    $this->assertIdentical($this->drupalGetHeader('X-Session-Empty'), '0', 'Session was not empty.');
  }
}

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