You are here

protected function BrowserTestBase::drupalUserIsLoggedIn in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/modules/simpletest/src/BrowserTestBase.php \Drupal\simpletest\BrowserTestBase::drupalUserIsLoggedIn()

Returns whether a given user account is logged in.

Parameters

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

Return value

bool Return TRUE if the user is logged in, FALSE otherwise.

1 call to BrowserTestBase::drupalUserIsLoggedIn()
BrowserTestBase::drupalLogin in core/modules/simpletest/src/BrowserTestBase.php
Logs in a user using the Mink controlled browser.

File

core/modules/simpletest/src/BrowserTestBase.php, line 1330
Contains \Drupal\simpletest\BrowserTestBase.

Class

BrowserTestBase
Provides a test case for functional Drupal tests.

Namespace

Drupal\simpletest

Code

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