diff --git a/core/tests/Drupal/Tests/BrowserTestBase.php b/core/tests/Drupal/Tests/BrowserTestBase.php index 47878ad..b4a685e 100644 --- a/core/tests/Drupal/Tests/BrowserTestBase.php +++ b/core/tests/Drupal/Tests/BrowserTestBase.php @@ -1615,18 +1615,14 @@ protected function cssSelect($selector) { * * @param string|\Drupal\Component\Render\MarkupInterface $label * Text between the anchor tags. - * @param int|null $index - * (optional) The index number for cases where multiple links have the text. + * @param int $index + * (optional) The index number for cases where multiple links have the same + * text. Defaults to 0. */ - protected function clickLink($label, $index = NULL) { + protected function clickLink($label, $index = 0) { $label = (string) $label; - if (is_integer($index)) { - $links = $this->getSession()->getPage()->findAll('named', array('link', $label)); - $links[$index]->click(); - } - else { - $this->getSession()->getPage()->clickLink($label); - } + $links = $this->getSession()->getPage()->findAll('named', ['link', $label]); + $links[$index]->click(); } /**