You are here

protected function UserCreationTrait::setCurrentUser in Zircon Profile 8

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

Switch the current logged in user.

Parameters

\Drupal\Core\Session\AccountInterface $account: The user account object.

1 call to UserCreationTrait::setCurrentUser()
RowRenderCacheTest::doTestRenderedOutput in core/modules/views/src/Tests/Plugin/RowRenderCacheTest.php
Check whether the rendered output matches expectations.

File

core/modules/simpletest/src/UserCreationTrait.php, line 31
Contains \Drupal\simpletest\UserCreationTrait.

Class

UserCreationTrait
Provides methods to create additional test users and switch the currently logged in one.

Namespace

Drupal\simpletest

Code

protected function setCurrentUser(AccountInterface $account) {
  \Drupal::currentUser()
    ->setAccount($account);
}