public function testParseValidXml()
 {
     $response = new ResponseCore(array(), $this->validXml, 200);
     $result = new GetLifecycleResult($response);
     $this->assertTrue($result->isOK());
     $this->assertNotNull($result->getData());
     $this->assertNotNull($result->getRawResponse());
     $lifecycleConfig = $result->getData();
     $this->assertEquals($this->cleanXml($this->validXml), $this->cleanXml($lifecycleConfig->serializeToXml()));
 }
Ejemplo n.º 2
0
 /**
  * 获取Bucket的Lifecycle配置情况
  *
  * @param string $bucket bucket名称
  * @param array $options
  * @throws OssException
  * @return LifecycleConfig
  */
 public function getBucketLifecycle($bucket, $options = NULL)
 {
     $this->precheckCommon($bucket, NULL, $options, false);
     $options[self::OSS_BUCKET] = $bucket;
     $options[self::OSS_METHOD] = self::OSS_HTTP_GET;
     $options[self::OSS_OBJECT] = '/';
     $options[self::OSS_SUB_RESOURCE] = 'lifecycle';
     $response = $this->auth($options);
     $result = new GetLifecycleResult($response);
     return $result->getData();
 }