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())); }
/** * 获取Bucket的Lifecycle配置情况 * * @param string $bucket bucket名称 * @param array $options * * @throws Exception * @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(); }