function MediaUiReferenceWidgetTest::assertHelpLink

Same name in other branches
  1. 11.x core/modules/media/tests/src/Functional/MediaUiReferenceWidgetTest.php \Drupal\Tests\media\Functional\MediaUiReferenceWidgetTest::assertHelpLink()

Asserts whether a given link is present.

@internal

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 MediaUiReferenceWidgetTest::assertHelpLink()
MediaUiReferenceWidgetTest::testMediaReferenceWidget in core/modules/media/tests/src/Functional/MediaUiReferenceWidgetTest.php
Tests the default autocomplete widgets for media reference fields.

File

core/modules/media/tests/src/Functional/MediaUiReferenceWidgetTest.php, line 329

Class

MediaUiReferenceWidgetTest
Ensures that media UI works correctly.

Namespace

Drupal\Tests\media\Functional

Code

protected function assertHelpLink(NodeElement $element, string $text, array $attributes = []) : void {
    // 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);
    }
}

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