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


PHP WebTestCase::get方法代碼示例

本文整理匯總了PHP中WebTestCase::get方法的典型用法代碼示例。如果您正苦於以下問題:PHP WebTestCase::get方法的具體用法?PHP WebTestCase::get怎麽用?PHP WebTestCase::get使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在WebTestCase的用法示例。


在下文中一共展示了WebTestCase::get方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: get

 function get($url, $parameters = NULL)
 {
     $parts = array();
     if (preg_match('#([\\w-]*):([\\w-]+|[^/]|$)((:(.*))*)#', $url, $parts) != 0 && $parts[1] != 'mailto') {
         list($zone_name, $vars, $hash) = page_link_decode($url);
         $real_url = _build_url($vars, $zone_name, NULL, false, false, false, $hash);
         $ret = parent::get($real_url, $parameters);
     } else {
         $ret = parent::get($url, $parameters);
     }
     // Save, so we can run validation on it later
     $path = get_file_base() . '/_tests/html_dump/' . get_class($this);
     if (!file_exists($path)) {
         mkdir($path, 0777);
     }
     $content = $this->_browser->getContent();
     $outfile = fopen($path . '/' . url_to_filename($url) . '.htm', 'wb');
     fwrite($outfile, $content);
     fclose($outfile);
     sync_file($path . '/' . url_to_filename($url) . '.htm');
     fix_permissions($path . '/' . url_to_filename($url) . '.htm');
     // Save the text so we can run through Word's grammar checker
     $text_content = $content;
     $text_content = preg_replace('#<[^>]* title="([^"]+)"<[^>]*>#U', '\\1', $text_content);
     $text_content = preg_replace('#<[^>]* alt="([^"]+)"<[^>]*>#U', '\\1', $text_content);
     $text_content = preg_replace('#<style[^>]*>.*</style>#Us', '', $text_content);
     $text_content = preg_replace('#<script[^>]*>.*</script>#Us', '', $text_content);
     $text_content = preg_replace('#<[^>]*>#U', '', $text_content);
     $text_content = preg_replace('#\\s\\s+#', '. ', $text_content);
     $text_content = str_replace('&ndash;', '-', $text_content);
     $text_content = str_replace('&mdash;', '-', $text_content);
     $text_content = str_replace('&hellip;', '...', $text_content);
     $text_content = @html_entity_decode($text_content, ENT_QUOTES);
     $outfile = fopen($path . '/' . url_to_filename($url) . '.txt', 'wb');
     fwrite($outfile, $text_content);
     fclose($outfile);
     return $ret;
 }
開發者ID:erico-deh,項目名稱:ocPortal,代碼行數:38,代碼來源:ocp_test_case.php

示例2: get

 /**
  *    Fetches a page into the page buffer. If
  *    there is no base for the URL then the
  *    current base URL is used. After the fetch
  *    the base URL reflects the new location.
  *
  *    When the requested URL is pointing at a
  *    resource inside the './site/protected/' part of
  *    the test site, than we will request the
  *    appropriate .htaccess fixup page first and
  *    make sure that it made all the right noises
  *    on return. This is done to prevent you from
  *    stumbling into a rain of 500-Internal Server
  *    Errors due to a site-specific part of
  *    .htaccess not having been setup yet.
  *
  *    For more info, read ./site/fix_protected_access.php
  *
  *    @param string $url          URL to fetch.
  *    @param hash $parameters     Optional additional GET data.
  *    @return boolean/string      Raw page on success.
  *    @access public
  */
 function get($url, $parameters = false)
 {
     $this->fix_protected_zone($url);
     return parent::get($url, $parameters);
 }
開發者ID:GerHobbelt,項目名稱:simpletest,代碼行數:28,代碼來源:acceptance_test.php


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