You are here

public function DynamicMenuLinkMock::setCurrentUser in Drupal 10

Same name and namespace in other branches
  1. 8 core/tests/Drupal/Tests/Core/Menu/DynamicMenuLinkMock.php \Drupal\Tests\Core\Menu\DynamicMenuLinkMock::setCurrentUser()
  2. 9 core/tests/Drupal/Tests/Core/Menu/DynamicMenuLinkMock.php \Drupal\Tests\Core\Menu\DynamicMenuLinkMock::setCurrentUser()

Sets the current user.

Allows the menu link to return the right title and route.

Parameters

\Drupal\Core\Session\AccountInterface $current_user: The current user.

Return value

$this

File

core/tests/Drupal/Tests/Core/Menu/DynamicMenuLinkMock.php, line 34

Class

DynamicMenuLinkMock
Defines a mock implementation of a dynamic menu link used in tests only.

Namespace

Drupal\Tests\Core\Menu

Code

public function setCurrentUser(AccountInterface $current_user) {
  $this->currentUser = $current_user;
  return $this;
}