當前位置: 首頁>>代碼示例>>PHP>>正文


PHP WebTestCase::clickLink方法代碼示例

本文整理匯總了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;
 }
開發者ID:sdboyer,項目名稱:sdboyer-test,代碼行數:29,代碼來源:drupal_test_case.php


注:本文中的WebTestCase::clickLink方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。