public function testParseValidXml() { $response = new ResponseCore(array(), $this->validXml, 200); $result = new GetLoggingResult($response); $this->assertTrue($result->isOK()); $this->assertNotNull($result->getData()); $this->assertNotNull($result->getRawResponse()); $loggingConfig = $result->getData(); $this->assertEquals($this->cleanXml($this->validXml), $this->cleanXml($loggingConfig->serializeToXml())); $this->assertEquals("TargetBucket", $loggingConfig->getTargetBucket()); $this->assertEquals("TargetPrefix", $loggingConfig->getTargetPrefix()); }
/** * 获取Bucket的访问日志配置情况 * * @param string $bucket bucket名称 * @param array $options 可以为空 * @throws OssException * @return LoggingConfig */ public function getBucketLogging($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] = 'logging'; $response = $this->auth($options); $result = new GetLoggingResult($response); return $result->getData(); }