protected function SessionAuthenticationTest::assertSessionData in Drupal 8
Same name and namespace in other branches
- 9 core/modules/system/tests/src/Functional/Session/SessionAuthenticationTest.php \Drupal\Tests\system\Functional\Session\SessionAuthenticationTest::assertSessionData()
Checks the session data returned by the session test routes.
Parameters
string $response: A response object containing the session values and the user ID.
string $expected: The expected session value.
1 call to SessionAuthenticationTest::assertSessionData()
- SessionAuthenticationTest::testBasicAuthSession in core/
modules/ system/ tests/ src/ Functional/ Session/ SessionAuthenticationTest.php - Tests if a session can be initiated through basic authentication.
File
- core/
modules/ system/ tests/ src/ Functional/ Session/ SessionAuthenticationTest.php, line 107
Class
- SessionAuthenticationTest
- Tests if sessions are correctly handled when a user authenticates.
Namespace
Drupal\Tests\system\Functional\SessionCode
protected function assertSessionData($response, $expected) {
$response = json_decode($response, TRUE);
$this
->assertEqual([
'test_value' => $expected,
], $response['session'], 'The session data matches the expected value.');
// Check that we are logged in as the correct user.
$this
->assertEqual($this->user
->id(), $response['user'], 'The correct user is logged in.');
}