当前位置: 首页>>代码示例>>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;未经允许,请勿转载。