From 4e0b442161c613d102f918c8b1920b9b40afec18 Mon Sep 17 00:00:00 2001 From: "Eirik S. Morland" Date: Thu, 6 Jun 2024 10:21:39 +0200 Subject: [PATCH] Make it possible to override how to get the log out link --- .../Manager/DrupalAuthenticationManager.php | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) 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} */