function ConfirmFormTest::assertCancelLinkUrl

Same name in other branches
  1. 8.9.x core/modules/system/tests/src/Functional/Form/ConfirmFormTest.php \Drupal\Tests\system\Functional\Form\ConfirmFormTest::assertCancelLinkUrl()

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

1 call to ConfirmFormTest::assertCancelLinkUrl()
ConfirmFormTest::testConfirmForm in modules/system/system.test
Tests that the confirm form does not use external destinations.

File

modules/system/system.test, line 3183

Class

ConfirmFormTest
Tests confirm form destinations.

Code

function assertCancelLinkUrl($url, $message = '', $group = 'Other') {
    $links = $this->xpath('//a[normalize-space(text())=:label and @href=:url]', array(
        ':label' => t('Cancel'),
        ':url' => $url,
    ));
    $message = $message ? $message : format_string('Cancel link with url %url found.', array(
        '%url' => $url,
    ));
    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.