function SessionHttpsTest::assertSessionIds

Same name and namespace in other branches
  1. 9 core/modules/system/tests/src/Functional/Session/SessionHttpsTest.php \Drupal\Tests\system\Functional\Session\SessionHttpsTest::assertSessionIds()
  2. 8.9.x core/modules/system/tests/src/Functional/Session/SessionHttpsTest.php \Drupal\Tests\system\Functional\Session\SessionHttpsTest::assertSessionIds()
  3. 10 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 266

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);
}

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