function AssertLegacyTrait::assertLink

Same name in other branches
  1. 8.9.x core/tests/Drupal/FunctionalTests/AssertLegacyTrait.php \Drupal\FunctionalTests\AssertLegacyTrait::assertLink()

Passes if a link with the specified label is found.

An optional link index may be passed.

Parameters

string|\Drupal\Component\Render\MarkupInterface $label: Text between the anchor tags.

int $index: Link position counting from zero.

Deprecated

in drupal:8.2.0 and is removed from drupal:10.0.0. Use $this->assertSession()->linkExists() instead.

See also

https://www.drupal.org/node/3129738

File

core/tests/Drupal/FunctionalTests/AssertLegacyTrait.php, line 445

Class

AssertLegacyTrait
Provides convenience methods for assertions in browser tests.

Namespace

Drupal\FunctionalTests

Code

protected function assertLink($label, $index = 0) {
    @trigger_error('AssertLegacyTrait::assertLink() is deprecated in drupal:8.2.0 and is removed from drupal:10.0.0. Use $this->assertSession()->linkExists() instead. See https://www.drupal.org/node/3129738', E_USER_DEPRECATED);
    return $this->assertSession()
        ->linkExists($label, $index);
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.