You are here

protected function SessionHttpsTest::assertSessionIds in Drupal 9

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

Tests that there exists a session with two specific session IDs.

Parameters

$sid: The insecure session ID to search for.

$assertion_text: The text to display when we perform the assertion.

1 call to SessionHttpsTest::assertSessionIds()
SessionHttpsTest::testHttpsSession in core/modules/system/tests/src/Functional/Session/SessionHttpsTest.php
Tests HTTPS sessions.

File

core/modules/system/tests/src/Functional/Session/SessionHttpsTest.php, line 262

Class

SessionHttpsTest
Ensure that when running under HTTPS two session cookies are generated.

Namespace

Drupal\Tests\system\Functional\Session

Code

protected function assertSessionIds($sid, $assertion_text) {
  $this
    ->assertNotEmpty(\Drupal::database()
    ->select('sessions', 's')
    ->fields('s', [
    'timestamp',
  ])
    ->condition('sid', Crypt::hashBase64($sid))
    ->execute()
    ->fetchField(), $assertion_text);
}