You are here

public function DynamicMenuLinkMock::getRouteName in Drupal 9

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

Returns the route name, if available.

Return value

string The name of the route this menu link links to.

Overrides MenuLinkBase::getRouteName

File

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

Class

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

Namespace

Drupal\Tests\Core\Menu

Code

public function getRouteName() {
  if ($this->currentUser
    ->isAuthenticated()) {
    return 'user.logout';
  }
  else {
    return 'user.login';
  }
}