You are here

protected function AssertLegacyTrait::assertLinkByHref in Drupal 9

Same name and namespace in other branches
  1. 8 core/tests/Drupal/FunctionalTests/AssertLegacyTrait.php \Drupal\FunctionalTests\AssertLegacyTrait::assertLinkByHref()

Passes if a link containing a given href (part) is found.

Parameters

string $href: The full or partial value of the 'href' attribute of the anchor tag.

int $index: Link position counting from zero.

Deprecated

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

See also

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

1 call to AssertLegacyTrait::assertLinkByHref()
AssertLegacyTraitTest::testAssertLinkByHref in core/tests/Drupal/Tests/Core/Assert/AssertLegacyTraitTest.php
@covers ::assertLinkByHref

File

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

Class

AssertLegacyTrait
Provides convenience methods for assertions in browser tests.

Namespace

Drupal\FunctionalTests

Code

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