diff options
author | Dries Buytaert <dries@buytaert.net> | 2009-11-14 07:58:50 +0000 |
---|---|---|
committer | Dries Buytaert <dries@buytaert.net> | 2009-11-14 07:58:50 +0000 |
commit | 8514a7e283b65f1085e0f3a96e1e701157532e88 (patch) | |
tree | 2aae47615521a689f66e92cca7140399e2c8269e /modules/simpletest | |
parent | fc980fa793ef2deb93f843d81568313caac9d2d6 (diff) | |
download | brdo-8514a7e283b65f1085e0f3a96e1e701157532e88.tar.gz brdo-8514a7e283b65f1085e0f3a96e1e701157532e88.tar.bz2 |
- Patch #301902 by TheRec, beeradb, catch, sun, skilip, alpritt, JacobSingh, Senpai: usability improvement: allow more users to see the node admin page.
Diffstat (limited to 'modules/simpletest')
-rw-r--r-- | modules/simpletest/drupal_web_test_case.php | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/modules/simpletest/drupal_web_test_case.php b/modules/simpletest/drupal_web_test_case.php index 98f4445ba..05d4e5828 100644 --- a/modules/simpletest/drupal_web_test_case.php +++ b/modules/simpletest/drupal_web_test_case.php @@ -1764,6 +1764,46 @@ class DrupalWebTestCase extends DrupalTestCase { } /** + * Pass if a link containing a given href (part) is found. + * + * @param $href + * The full or partial value of the 'href' attribute of the anchor tag. + * @param $index + * Link position counting from zero. + * @param $message + * Message to display. + * @param $group + * The group this message belongs to, defaults to 'Other'. + * + * @return + * TRUE if the assertion succeeded, FALSE otherwise. + */ + protected function assertLinkByHref($href, $index = 0, $message = '', $group = 'Other') { + $links = $this->xpath('//a[contains(@href, "' . $href . '")]'); + $message = ($message ? $message : t('Link containing href %href found.', array('%href' => $href))); + return $this->assert(isset($links[$index]), $message, $group); + } + + /** + * Pass if a link containing a given href (part) is not found. + * + * @param $href + * The full or partial value of the 'href' attribute of the anchor tag. + * @param $message + * Message to display. + * @param $group + * The group this message belongs to, defaults to 'Other'. + * + * @return + * TRUE if the assertion succeeded, FALSE otherwise. + */ + protected function assertNoLinkByHref($href, $message = '', $group = 'Other') { + $links = $this->xpath('//a[contains(@href, "' . $href . '")]'); + $message = ($message ? $message : t('No link containing href %href found.', array('%href' => $href))); + return $this->assert(empty($links), $message, $group); + } + + /** * Follows a link by name. * * Will click the first link found with this link text by default, or a |