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


PHP AmazonS3::get方法代码示例

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


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

示例1: testGetFail

 /**
  * @covers mychaelstyle\storage\providers\AmazonS3::get
  * @covers mychaelstyle\storage\providers\AmazonS3::__mergePutOptions
  * @covers mychaelstyle\storage\providers\AmazonS3::__formatUri
  * @expectedException mychaelstyle\Exception
  */
 public function testGetFail()
 {
     if ($this->markIncompleteIfNoNetwork()) {
         return true;
     }
     // not exists
     $result = $this->object->get('notexist.txt');
     $this->assertNull($result);
 }
开发者ID:mychaelstyle,项目名称:php-utils,代码行数:15,代码来源:AmazonS3Test.php

示例2: testGetBuggyXmlException

 /**
  * testGetBuggyXmlException
  *
  * @return void
  * @author Rob Mcvey
  * @expectedException AmazonS3Exception
  * @expectedExceptionMessage There was an error communicating with AWS
  **/
 public function testGetBuggyXmlException()
 {
     $localPath = APP . 'Plugin' . DS . 'AmazonS3' . DS . 'Test' . DS . 'test_app' . DS . 'webroot' . DS . 'files';
     $file = 'lolcat.jpg';
     $fullpath = $localPath . DS . $file;
     $this->AmazonS3->setDate('Mon, 23 Sep 2013 08:46:05 GMT');
     // Mock the built request
     $expectedRequest = array('method' => 'GET', 'uri' => array('host' => 'bucket.s3.amazonaws.com', 'scheme' => 'https', 'path' => 'lolcat.jpg'), '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 = '<?xml version="1.0" encoding="UTF-8"?><Error><Code>Woops</Code><RequestId>2342134123</RequestId><HostId>DFHGDHGDHDFGH</HostId><AWSAccessKeyId>foo</AWSAccessKeyId></Error>';
     $HttpSocketResponse->code = 403;
     $HttpSocketResponse->headers = array('x-amz-id-2' => '4589328529385938', 'x-amz-request-id' => 'GSDFGt45egdfsC', 'Date' => 'Mon, 23 Sep 2013 08:46:05 GMT', 'Accept-Ranges' => 'bytes', 'Content-Type' => 'application/xml', 'Transfer-Encoding' => 'chunked', 'Connection' => 'close', 'Server' => 'AmazonS3');
     // Mock the HttpSocket class
     $this->AmazonS3->HttpSocket = $this->getMock('HttpSocket');
     $this->AmazonS3->HttpSocket->expects($this->once())->method('request')->with()->will($this->returnValue($HttpSocketResponse));
     $this->AmazonS3->get($file, $localPath);
     $this->assertFalse(file_exists($fullpath));
     unlink($fullpath);
     // Bye bye just in case
 }
开发者ID:eltonrodrigues,项目名称:cakephp-amazon-s3,代码行数:29,代码来源:AmazonS3Test.php


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