diff --git a/src/Drupal/DrupalExtension/Manager/DrupalAuthenticationManager.php b/src/Drupal/DrupalExtension/Manager/DrupalAuthenticationManager.php index 2b5ee3f3..93ac770f 100644 --- a/src/Drupal/DrupalExtension/Manager/DrupalAuthenticationManager.php +++ b/src/Drupal/DrupalExtension/Manager/DrupalAuthenticationManager.php @@ -148,7 +148,7 @@ public function loggedIn() // As a last resort, if a logout link is found, we are logged in. While not // perfect, this is how Drupal SimpleTests currently work as well. - if ($page->findLink($this->getDrupalText('log_out'))) { + if ($this->getLogoutLinkElement()) { return true; } @@ -158,6 +158,14 @@ public function loggedIn() return false; } + /** + * Helper to get the log out link from the page. + */ + public function getLogoutLinkElement() + { + return $this->getSession()->getPage()->findLink($this->getDrupalText('log_out')); + } + /** * {@inheritdoc} */