You are here

public function ConfirmFormTest::assertCancelLinkUrl in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/modules/system/src/Tests/Form/ConfirmFormTest.php \Drupal\system\Tests\Form\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/src/Tests/Form/ConfirmFormTest.php
Tests that the confirm form does not use external destinations.

File

core/modules/system/src/Tests/Form/ConfirmFormTest.php, line 85
Contains \Drupal\system\Tests\Form\ConfirmFormTest.

Class

ConfirmFormTest
Tests confirmation forms.

Namespace

Drupal\system\Tests\Form

Code

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