Наследование: extends OSS\Result\Result
 public function testOkResponse()
 {
     $header = array();
     $response = new ResponseCore($header, $this->body, 200);
     $result = new CopyObjectResult($response);
     $data = $result->getData();
     $this->assertTrue($result->isOK());
     $this->assertEquals("Fri, 24 Feb 2012 07:18:48 GMT", $data[0]);
     $this->assertEquals("\"5B3C1A2E053D763E1B002CC607C5A0FE\"", $data[1]);
 }
Пример #2
0
 /**
  * 拷贝一个在OSS上已经存在的object成另外一个object
  *
  * @param string $fromBucket 源bucket名称
  * @param string $fromObject 源object名称
  * @param string $toBucket 目标bucket名称
  * @param string $toObject 目标object名称
  * @param array $options
  * @return null
  * @throws OssException
  */
 public function copyObject($fromBucket, $fromObject, $toBucket, $toObject, $options = NULL)
 {
     $this->precheckCommon($fromBucket, $fromObject, $options);
     $this->precheckCommon($toBucket, $toObject, $options);
     $options[self::OSS_BUCKET] = $toBucket;
     $options[self::OSS_METHOD] = self::OSS_HTTP_PUT;
     $options[self::OSS_OBJECT] = $toObject;
     if (isset($options[self::OSS_HEADERS])) {
         $options[self::OSS_HEADERS][self::OSS_OBJECT_COPY_SOURCE] = '/' . $fromBucket . '/' . $fromObject;
     } else {
         $options[self::OSS_HEADERS] = array(self::OSS_OBJECT_COPY_SOURCE => '/' . $fromBucket . '/' . $fromObject);
     }
     $response = $this->auth($options);
     $result = new CopyObjectResult($response);
     return $result->getData();
 }