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());
 }
Ejemplo n.º 2
0
 /**
  * 获取Bucket的访问日志配置情况
  *
  * @param string $bucket  bucket名称
  * @param array  $options 可以为空
  *
  * @throws Exception
  * @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();
 }