示例#1
0
文件: S3RestTest.php 项目: rudrud/zf2
    /**
     * Test get buckets
     *
     * @return void
     */
    public function testGetBuckets()
    {
        $expected = array('quotes', 'samples');
        // Http Response results
        $this->httpResponse->expects($this->any())->method('getStatusCode')->will($this->returnValue(200));
        $rawBody = <<<BODY
<?xml version="1.0" encoding="UTF-8"?>
<ListAllMyBucketsResult xmlns="http://doc.s3.amazonaws.com/2006-03-01">
    <Owner>
        <ID>bcaf1ffd86f461ca5fb16fd081034f</ID>
        <DisplayName>webfile</DisplayName>
    </Owner>
    <Buckets>
        <Bucket>
            <Name>quotes</Name>
            <CreationDate>2006-02-03T16:45:09.000Z</CreationDate>
        </Bucket>
        <Bucket>
            <Name>samples</Name>
            <CreationDate>2006-02-03T16:41:58.000Z</CreationDate>
        </Bucket>
    </Buckets>
</ListAllMyBucketsResult>
BODY;
        $this->httpResponse->expects($this->any())->method('getBody')->will($this->returnValue($rawBody));
        // 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));
        $buckets = $this->amazon->getBuckets();
        $this->assertEquals($expected, $buckets);
    }