本文整理汇总了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;
}