You are here

public function ApdqcSessionTestCase::assertSessionEmpty in Asynchronous Prefetch Database Query Cache 7

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

1 call to ApdqcSessionTestCase::assertSessionEmpty()
ApdqcSessionTestCase::testEmptyAnonymousSession in ./apdqc.test
Test that empty anonymous sessions are destroyed.

File

./apdqc.test, line 699
Tests for the Asynchronous Prefetch Database Query Cache module.

Class

ApdqcSessionTestCase
Tests for the session system.

Code

public function assertSessionEmpty($empty) {
  $headers = $this
    ->drupalGetHeaders();
  if (!isset($headers['x-session-empty']) && !isset($headers['X-Session-Empty'])) {
    $this
      ->pass('X-Session-Empty header not found.');
  }
  else {
    if ($empty) {
      $this
        ->assertIdentical($this
        ->drupalGetHeader('X-Session-Empty'), '1', 'Session was empty.' . microtime(TRUE));
    }
    else {
      $this
        ->assertIdentical($this
        ->drupalGetHeader('X-Session-Empty'), '0', 'Session was not empty.' . microtime(TRUE));
    }
  }
}