You are here

protected function MediaUiFunctionalTest::assertHelpLink in Drupal 9

Same name and namespace in other branches
  1. 8 core/modules/media/tests/src/Functional/MediaUiFunctionalTest.php \Drupal\Tests\media\Functional\MediaUiFunctionalTest::assertHelpLink()

Asserts whether a given link is present.

Parameters

\Behat\Mink\Element\NodeElement $element: The element to search.

string $text: The link text.

string[] $attributes: An associative array of any expected attributes, keyed by the attribute name.

1 call to MediaUiFunctionalTest::assertHelpLink()
MediaUiFunctionalTest::testMediaReferenceWidget in core/modules/media/tests/src/Functional/MediaUiFunctionalTest.php
Tests the default autocomplete widgets for media reference fields.

File

core/modules/media/tests/src/Functional/MediaUiFunctionalTest.php, line 518

Class

MediaUiFunctionalTest
Ensures that media UI works correctly.

Namespace

Drupal\Tests\media\Functional

Code

protected function assertHelpLink(NodeElement $element, $text, array $attributes = []) {

  // Find all the links inside the element.
  $link = $element
    ->findLink($text);
  $this
    ->assertNotEmpty($link);
  foreach ($attributes as $attribute => $value) {
    $this
      ->assertSame($link
      ->getAttribute($attribute), $value);
  }
}