protected function UserSessionTest::createUserSession in Drupal 9
Same name and namespace in other branches
- 8 core/tests/Drupal/Tests/Core/Session/UserSessionTest.php \Drupal\Tests\Core\Session\UserSessionTest::createUserSession()
Setups a user session for the test.
Parameters
array $rids: The rids of the user.
bool $authenticated: TRUE if it is an authenticated user.
Return value
\Drupal\Core\Session\AccountInterface The created user session.
1 call to UserSessionTest::createUserSession()
- UserSessionTest::setUp in core/
tests/ Drupal/ Tests/ Core/ Session/ UserSessionTest.php
1 method overrides UserSessionTest::createUserSession()
- UserTest::createUserSession in core/
modules/ user/ tests/ src/ Unit/ Plugin/ Core/ Entity/ UserTest.php - Setups a user session for the test.
File
- core/
tests/ Drupal/ Tests/ Core/ Session/ UserSessionTest.php, line 49
Class
- UserSessionTest
- @coversDefaultClass \Drupal\Core\Session\UserSession @group Session
Namespace
Drupal\Tests\Core\SessionCode
protected function createUserSession(array $rids = [], $authenticated = FALSE) {
array_unshift($rids, $authenticated ? RoleInterface::AUTHENTICATED_ID : RoleInterface::ANONYMOUS_ID);
return new UserSession([
'roles' => $rids,
]);
}