You are here

function ConfirmFormTest::assertCancelLinkUrl in Drupal 7

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 3093
Tests for system.module.

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