当前位置: 首页>>代码示例>>PHP>>正文


PHP Request::createFromServerArray方法代码示例

本文整理汇总了PHP中Sabre\HTTP\Request::createFromServerArray方法的典型用法代码示例。如果您正苦于以下问题:PHP Request::createFromServerArray方法的具体用法?PHP Request::createFromServerArray怎么用?PHP Request::createFromServerArray使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Sabre\HTTP\Request的用法示例。


在下文中一共展示了Request::createFromServerArray方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: request

 /**
  * Makes a request, and returns a response object.
  *
  * You can either pass an instance of Sabre\HTTP\Request, or an array,
  * which will then be used as the _SERVER array.
  *
  * @param array|\Sabre\HTTP\Request $request
  * @return \Sabre\HTTP\Response
  */
 function request($request)
 {
     if (is_array($request)) {
         $request = HTTP\Request::createFromServerArray($request);
     }
     $this->server->httpRequest = $request;
     $this->server->httpResponse = new HTTP\ResponseMock();
     $this->server->exec();
     return $this->server->httpResponse;
 }
开发者ID:Befox,项目名称:cdav,代码行数:19,代码来源:DAVServerTest.php

示例2: request

 /**
  * Makes a request, and returns a response object.
  *
  * You can either pass an instance of Sabre\HTTP\Request, or an array,
  * which will then be used as the _SERVER array.
  *
  * If $expectedStatus is set, we'll compare it with the HTTP status of
  * the returned response. If it doesn't match, we'll immediately fail
  * the test.
  *
  * @param array|\Sabre\HTTP\Request $request
  * @param int $expectedStatus
  * @return \Sabre\HTTP\Response
  */
 function request($request, $expectedStatus = null)
 {
     if (is_array($request)) {
         $request = HTTP\Request::createFromServerArray($request);
     }
     $response = new HTTP\ResponseMock();
     $this->server->httpRequest = $request;
     $this->server->httpResponse = $response;
     $this->server->exec();
     if ($expectedStatus) {
         $responseBody = $expectedStatus !== $response->getStatus() ? $response->getBodyAsString() : '';
         $this->assertEquals($expectedStatus, $response->getStatus(), 'Incorrect HTTP status received for request. Response body: ' . $responseBody);
     }
     return $this->server->httpResponse;
 }
开发者ID:BlaBlaNet,项目名称:hubzilla,代码行数:29,代码来源:DAVServerTest.php


注:本文中的Sabre\HTTP\Request::createFromServerArray方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。