本文整理汇总了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);
}