Commit ca858345 authored by webchick's avatar webchick

#255613 by boombatower: Replace old crufty manual cURL call with nice drupalGet().

parent dae71fe8
......@@ -1195,7 +1195,6 @@ public function assertNoLink($label, $message = '', $group = 'Other') {
* later one if an index is given. Match is case insensitive with
* normalized space. The label is translated label. There is an assert
* for successful click.
* WARNING: Assertion fails on empty ("") output from the clicked link.
*
* @param $label
* Text between the anchor tags.
......@@ -1206,15 +1205,18 @@ public function assertNoLink($label, $message = '', $group = 'Other') {
*/
function clickLink($label, $index = 0) {
$url_before = $this->getUrl();
$ret = FALSE;
$urls = $this->xpath('//a[text()="' . $label . '"]');
if (isset($urls[$index])) {
$url_target = $this->getAbsoluteUrl($urls[$index]['href']);
$curl_options = array(CURLOPT_URL => $url_target);
$ret = $this->curlExec($curl_options);
}
$this->assertTrue($ret, t('Clicked link !label (!url_target) from !url_before', array('!label' => $label, '!url_target' => $url_target, '!url_before' => $url_before)), t('Browser'));
return $ret;
$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);
}
return FALSE;
}
/**
......
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