function ConfirmFormTest::assertCancelLinkUrl

Same name in other branches
  1. 7.x modules/system/system.test \ConfirmFormTest::assertCancelLinkUrl()

Asserts that a cancel link is present pointing to the provided URL.

Parameters

\Drupal\Core\Url $url: The url to check for.

string $message: The assert message.

string $group: The assertion group.

Return value

bool Result of the assertion.

1 call to ConfirmFormTest::assertCancelLinkUrl()
ConfirmFormTest::testConfirmFormWithExternalDestination in core/modules/system/tests/src/Functional/Form/ConfirmFormTest.php
Tests that the confirm form does not use external destinations.

File

core/modules/system/tests/src/Functional/Form/ConfirmFormTest.php, line 85

Class

ConfirmFormTest
Tests confirmation forms.

Namespace

Drupal\Tests\system\Functional\Form

Code

public function assertCancelLinkUrl(Url $url, $message = '', $group = 'Other') {
    $links = $this->xpath('//a[@href=:url]', [
        ':url' => $url->toString(),
    ]);
    $message = $message ? $message : new FormattableMarkup('Cancel link with URL %url found.', [
        '%url' => $url->toString(),
    ]);
    return $this->assertTrue(isset($links[0]), $message, $group);
}

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