protected function elementIsTargetLink(NodeElement $element, string $link_text): bool
    {
        $current_item_name = strtolower($element->find('css', '.ab-item')->getText());

        switch (strtolower($link_text)) {
            case 'wordpress':
                $is_link = $element->getAttribute('id') === 'wp-admin-bar-wp-logo';
                break;
            case 'updates':
                $is_link = $element->getAttribute('id') === 'wp-admin-bar-updates';
                break;
            case 'comments':
                $is_link = $element->getAttribute('id') === 'wp-admin-bar-comments';
                break;
            default:
                $is_link = strtolower($link_text) === $current_item_name;
        }

        return $is_link;
    }
protected function elementIsTargetLink(NodeElement $element, string $link_text): bool
    {
        $current_item_name = strtolower($element->find('css', '.ab-item')->getText());

        switch (strtolower($link_text)) {
            case 'wordpress':
                $is_link = $element->getAttribute('id') === 'wp-admin-bar-wp-logo';
                break;
            case 'updates':
                $is_link = $element->getAttribute('id') === 'wp-admin-bar-updates';
                break;
            case 'comments':
                $is_link = $element->getAttribute('id') === 'wp-admin-bar-comments';
                break;
            default:
                $is_link = strtolower($link_text) === $current_item_name;
        }

        return $is_link;
    }
protected function elementIsTargetLink ( NodeElement $ element , string $ link_text ) : bool { $ current_item_name = strtolower ( $ element -> find ( 'css' , '.ab-item' ) -> getText ( ) ) ; switch ( strtolower ( $ link_text ) ) { case 'wordpress' : $ is_link = $ element -> getAttribute ( 'id' ) === 'wp-admin-bar-wp-logo' ; break ; case 'updates' : $ is_link = $ element -> getAttribute ( 'id' ) === 'wp-admin-bar-updates' ; break ; case 'comments' : $ is_link = $ element -> getAttribute ( 'id' ) === 'wp-admin-bar-comments' ; break ; default : $ is_link = strtolower ( $ link_text ) === $ current_item_name ; } return $ is_link ; }
Determines whether the link name refers to the given NodeElement.

Some toolbar links do not have any visible text, so we handle those
separately. Otherwise we compare the link text to the text of the
element.

@param \Behat\Mink\Element\NodeElement $element The element to check
@param string $link_text The link (text) to check for

@return bool True if $link_text refers to $element. False otherwise.
Determines whether the link name refers to the given NodeElement .