本文整理汇总了PHP中AmazonS3::delete方法的典型用法代码示例。如果您正苦于以下问题:PHP AmazonS3::delete方法的具体用法?PHP AmazonS3::delete怎么用?PHP AmazonS3::delete使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AmazonS3
的用法示例。
在下文中一共展示了AmazonS3::delete方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testDelete
/**
* testDelete
*
* @return void
* @author Rob Mcvey
**/
public function testDelete()
{
$file = 'public/dots.csv';
$this->AmazonS3->setDate('Mon, 23 Sep 2013 08:46:05 GMT');
// Mock the built request
$expectedRequest = array('method' => 'DELETE', 'uri' => array('host' => 'bucket.s3.amazonaws.com', 'scheme' => 'https', 'path' => 'public/dots.csv'), 'header' => array('Accept' => '*/*', 'User-Agent' => 'CakePHP', 'Date' => 'Mon, 23 Sep 2013 08:46:05 GMT', 'Authorization' => 'AWS foo:+UdJAQGhwJf06KRWWIXumX/5V4Y='));
// Mock the HttpSocket response
$HttpSocketResponse = new stdClass();
$HttpSocketResponse->body = '';
$HttpSocketResponse->code = 204;
$HttpSocketResponse->reasonPhrase = 'No Content';
$HttpSocketResponse->headers = array('x-amz-id-2' => '4589328529385938', 'x-amz-request-id' => 'GSDFGt45egdfsC', 'Date' => 'Mon, 23 Sep 2013 08:46:05 GMT', 'Connection' => 'close', 'Server' => 'AmazonS3');
// Mock the HttpSocket class
$this->AmazonS3->HttpSocket = $this->getMock('HttpSocket');
$this->AmazonS3->HttpSocket->expects($this->once())->method('request')->with($expectedRequest)->will($this->returnValue($HttpSocketResponse));
$this->AmazonS3->delete($file);
}