protected function UiHelperTrait::drupalUserIsLoggedIn in Drupal 10
Same name and namespace in other branches
- 8 core/tests/Drupal/Tests/UiHelperTrait.php \Drupal\Tests\UiHelperTrait::drupalUserIsLoggedIn()
 - 9 core/tests/Drupal/Tests/UiHelperTrait.php \Drupal\Tests\UiHelperTrait::drupalUserIsLoggedIn()
 
Returns whether a given user account is logged in.
Parameters
\Drupal\Core\Session\AccountInterface $account: The user account object to check.
Return value
bool Return TRUE if the user is logged in, FALSE otherwise.
1 call to UiHelperTrait::drupalUserIsLoggedIn()
- UserHelpersTest::testDrupalUserIsLoggedIn in core/
tests/ Drupal/ FunctionalTests/ UserHelpersTest.php  - Tests BrowserTestBase::drupalUserIsLoggedIn().
 
File
- core/
tests/ Drupal/ Tests/ UiHelperTrait.php, line 356  
Class
- UiHelperTrait
 - Provides UI helper methods.
 
Namespace
Drupal\TestsCode
protected function drupalUserIsLoggedIn(AccountInterface $account) {
  $logged_in = FALSE;
  if (isset($account->sessionId)) {
    $session_handler = \Drupal::service('session_handler.storage');
    $logged_in = (bool) $session_handler
      ->read($account->sessionId);
  }
  return $logged_in;
}