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


PHP Http::expects方法代码示例

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


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

示例1: testCreateBuckets

 /**
  * Test create bucket
  *
  * @return void
  */
 public function testCreateBuckets()
 {
     //Valid bucket name
     $bucket = 'iamavalidbucket';
     $location = '';
     $accessKey = 'AKIAIDCZ2WXN6NNB7YZA';
     $secretKey = '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';
     $requestDate = DateTime::createFromFormat(DateTime::RFC1123, 'Tue, 15 May 2012 15:18:31 +0000');
     $this->amazon->setRequestDate($requestDate);
     $this->amazon->setKeys($accessKey, $secretKey);
     //Fake keys
     /**
      * Check of request inside _makeRequest
      *
      */
     $this->uriHttp->expects($this->once())->method('getHost')->with()->will($this->returnValue('s3.amazonaws.com'));
     $this->uriHttp->expects($this->once())->method('setHost')->with('iamavalidbucket.s3.amazonaws.com');
     $this->uriHttp->expects($this->once())->method('setPath')->with('/');
     $this->httpClient->expects($this->once())->method('setUri')->with($this->uriHttp);
     $this->httpClient->expects($this->once())->method('setMethod')->with('PUT');
     $this->httpClient->expects($this->once())->method('setHeaders')->with(array("Date" => "Tue, 15 May 2012 15:18:31 +0000", "Content-Type" => "application/xml", "Authorization" => "AWS " . $accessKey . ":Y+T4nZxI1wBi1Yn1BMnOK9CDiOM="));
     /**
      * Fake response inside _makeRequest
      *
      */
     // Http Response results
     $this->httpResponse->expects($this->any())->method('getStatusCode')->will($this->returnValue(200));
     // Expects to be called only once the method send() then return a Http Response.
     $this->httpClient->expects($this->once())->method('send')->will($this->returnValue($this->httpResponse));
     $response = $this->amazon->createBucket($bucket, $location);
     $this->assertTrue($response);
 }
开发者ID:robborocks,项目名称:ZendService_Amazon,代码行数:37,代码来源:S3RestTest.php


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