Commit 3a2eff71 authored by Dries's avatar Dries

- Patch #553524 by John Morahan: escape link text in assertions.

parent 652f90d1
......@@ -1728,7 +1728,7 @@ protected function getAllOptions(SimpleXMLElement $element) {
*/
protected function assertLink($label, $index = 0, $message = '', $group = 'Other') {
$links = $this->xpath('//a[text()="' . $label . '"]');
$message = ($message ? $message : t('Link with label "!label" found.', array('!label' => $label)));
$message = ($message ? $message : t('Link with label %label found.', array('%label' => $label)));
return $this->assert(isset($links[$index]), $message, $group);
}
......@@ -1748,7 +1748,7 @@ protected function assertLink($label, $index = 0, $message = '', $group = 'Other
*/
protected function assertNoLink($label, $message = '', $group = 'Other') {
$links = $this->xpath('//a[text()="' . $label . '"]');
$message = ($message ? $message : t('Link with label "!label" not found.', array('!label' => $label)));
$message = ($message ? $message : t('Link with label %label not found.', array('%label' => $label)));
return $this->assert(empty($links), $message, $group);
}
......@@ -1775,7 +1775,7 @@ protected function clickLink($label, $index = 0) {
$url_target = $this->getAbsoluteUrl($urls[$index]['href']);
}
$this->assertTrue(isset($urls[$index]), t('Clicked link "!label" (!url_target) from !url_before', array('!label' => $label, '!url_target' => $url_target, '!url_before' => $url_before)), t('Browser'));
$this->assertTrue(isset($urls[$index]), t('Clicked link %label (@url_target) from @url_before', array('%label' => $label, '@url_target' => $url_target, '@url_before' => $url_before)), t('Browser'));
if (isset($urls[$index])) {
return $this->drupalGet($url_target);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment