You are here

public function SessionTest::assertSessionCookie in Drupal 9

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

Assert whether the SimpleTest browser sent a session cookie.

3 calls to SessionTest::assertSessionCookie()
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.
SessionTest::testSessionSaveRegenerate in core/modules/system/tests/src/Functional/Session/SessionTest.php
Tests for \Drupal\Core\Session\WriteSafeSessionHandler::setSessionWritable() ::isSessionWritable and \Drupal\Core\Session\SessionManager::regenerate().

File

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

Class

SessionTest
Drupal session handling tests.

Namespace

Drupal\Tests\system\Functional\Session

Code

public function assertSessionCookie($sent) {
  if ($sent) {
    $this
      ->assertNotEmpty($this
      ->getSessionCookies()
      ->count(), 'Session cookie was sent.');
  }
  else {
    $this
      ->assertEmpty($this
      ->getSessionCookies()
      ->count(), 'Session cookie was not sent.');
  }
}