You are here

protected function SessionHttpsTest::assertSessionIds in Drupal 10

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()
  2. 9 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.

@internal

Parameters

string $sid: The insecure session ID to search for.

string $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 264

Class

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

Namespace

Drupal\Tests\system\Functional\Session

Code

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