You are here

protected function WebTestBase::drupalUserIsLoggedIn in Zircon Profile 8

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

Returns whether a given user account is logged in.

Parameters

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

2 calls to WebTestBase::drupalUserIsLoggedIn()
UserHelpersTest::testDrupalUserIsLoggedIn in core/modules/simpletest/src/Tests/UserHelpersTest.php
Tests 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 628
Contains \Drupal\simpletest\WebTestBase.

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;
}