protected function SessionAuthenticationTest::assertSessionData in Zircon Profile 8
Same name and namespace in other branches
- 8.0 core/modules/system/src/Tests/Session/SessionAuthenticationTest.php \Drupal\system\Tests\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/ src/ Tests/ Session/ SessionAuthenticationTest.php - Tests if a session can be initiated through basic authentication.
File
- core/
modules/ system/ src/ Tests/ Session/ SessionAuthenticationTest.php, line 105 - Contains \Drupal\system\Tests\Session\SessionAuthenticationTest.
Class
- SessionAuthenticationTest
- Tests if sessions are correctly handled when a user authenticates.
Namespace
Drupal\system\Tests\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.');
}