function MediaUiFunctionalTest::assertHelpLink

Same name in other branches
  1. 9 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 512

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);
    }
}

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