You are here

protected function WebTestBase::drupalUserIsLoggedIn in Drupal 8

Returns whether a given user account is logged in.

Parameters

\Drupal\user\UserInterface $account: The user account object to check.

1 call to WebTestBase::drupalUserIsLoggedIn()
WebTestBase::drupalLogin in core/modules/simpletest/src/WebTestBase.php
Log in a user with the internal browser.

File

core/modules/simpletest/src/WebTestBase.php, line 317

Class

WebTestBase
Test case for typical Drupal tests.

Namespace

Drupal\simpletest

Code

protected function drupalUserIsLoggedIn($account) {
  $logged_in = FALSE;
  if (isset($account->session_id)) {
    $session_handler = $this->container
      ->get('session_handler.storage');
    $logged_in = (bool) $session_handler
      ->read($account->session_id);
  }
  return $logged_in;
}