function SessionHttpsTest::assertSessionIds

Same name in other branches
  1. 9 core/modules/system/tests/src/Functional/Session/SessionHttpsTest.php \Drupal\Tests\system\Functional\Session\SessionHttpsTest::assertSessionIds()
  2. 10 core/modules/system/tests/src/Functional/Session/SessionHttpsTest.php \Drupal\Tests\system\Functional\Session\SessionHttpsTest::assertSessionIds()
  3. 11.x core/modules/system/tests/src/Functional/Session/SessionHttpsTest.php \Drupal\Tests\system\Functional\Session\SessionHttpsTest::assertSessionIds()

Test 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.

Return value

The result of assertTrue() that there's a session in the system that has the given insecure and secure session IDs.

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 256

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) {
    return $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.