本文整理匯總了PHP中WebTestCase::clickLink方法的典型用法代碼示例。如果您正苦於以下問題:PHP WebTestCase::clickLink方法的具體用法?PHP WebTestCase::clickLink怎麽用?PHP WebTestCase::clickLink使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類WebTestCase
的用法示例。
在下文中一共展示了WebTestCase::clickLink方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: clickLink
/**
* Follows a link by name.
*
* Will click the first link found with this link text by default, or a
* 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 string $label Text between the anchor tags.
* @param integer $index Link position counting from zero.
* @param boolean $reporting Assertions or not
* @return boolean/string Page on success.
*
* @access public
*/
function clickLink($label, $index = 0)
{
$url_before = $this->getUrl();
$urls = $this->_browser->_page->getUrlsByLabel($label);
if (count($urls) < $index + 1) {
$url_target = 'URL NOT FOUND!';
} else {
$url_target = $urls[$index]->asString();
}
$ret = parent::clickLink(t($label), $index);
$this->assertTrue($ret, ' [browser] clicked link ' . t($label) . " ({$url_target}) from {$url_before}");
return $ret;
}