public function testParseValidXml()
 {
     $response = new ResponseCore(array(), $this->validXml, 200);
     $result = new GetCorsResult($response);
     $this->assertTrue($result->isOK());
     $this->assertNotNull($result->getData());
     $this->assertNotNull($result->getRawResponse());
     $corsConfig = $result->getData();
     $this->assertEquals($this->cleanXml($this->validXml), $this->cleanXml($corsConfig->serializeToXml()));
 }
Example #2
0
 /**
  * 获取Bucket的CORS配置情况
  *
  * @param string $bucket  bucket名称
  * @param array  $options 可以为空
  *
  * @throws Exception
  * @return CorsConfig
  */
 public function getBucketCors($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] = 'cors';
     $response = $this->auth($options);
     $result = new GetCorsResult($response, __FUNCTION__);
     return $result->getData();
 }