You are here

protected function UserSessionTest::createUserSession in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 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 53
Contains \Drupal\Tests\Core\Session\UserSessionTest.

Class

UserSessionTest
@coversDefaultClass \Drupal\Core\Session\UserSession @group Session

Namespace

Drupal\Tests\Core\Session

Code

protected function createUserSession(array $rids = array(), $authenticated = FALSE) {
  array_unshift($rids, $authenticated ? RoleInterface::AUTHENTICATED_ID : RoleInterface::ANONYMOUS_ID);
  return new UserSession(array(
    'roles' => $rids,
  ));
}