コード例 #1
0
 public function testParseNullXml()
 {
     $response = new ResponseCore(array(), $this->nullXml, 200);
     $result = new ListBucketsResult($response);
     $this->assertTrue($result->isOK());
     $this->assertNotNull($result->getData());
     $this->assertNotNull($result->getRawResponse());
     $bucketListInfo = $result->getData();
     $this->assertEquals(0, count($bucketListInfo->getBucketList()));
 }
コード例 #2
0
ファイル: OSSClient.php プロジェクト: lokielse/php-aliyun-oss
 /**
  * 列举用户所有的Bucket[GetService], Endpoint类型为cname不能进行此操作
  *
  * @param array $options
  *
  * @throws Exception
  * @return BucketListInfo
  */
 public function listBuckets($options = null)
 {
     if ($this->hostType === self::OSS_HOST_TYPE_CNAME) {
         throw new Exception("operation is not permitted with CName host");
     }
     $this->precheckOptions($options);
     $options[self::OSS_BUCKET] = '';
     $options[self::OSS_METHOD] = self::OSS_HTTP_GET;
     $options[self::OSS_OBJECT] = '/';
     $response = $this->auth($options);
     $result = new ListBucketsResult($response);
     return $result->getData();
 }