public function testParseValidXml()
 {
     $response = new ResponseCore(array(), $this->validXml, 200);
     $result = new ListPartsResult($response);
     $listPartsInfo = $result->getData();
     $this->assertEquals("multipart_upload", $listPartsInfo->getBucket());
     $this->assertEquals("multipart.data", $listPartsInfo->getKey());
     $this->assertEquals("0004B999EF5A239BB9138C6227D69F95", $listPartsInfo->getUploadId());
     $this->assertEquals(5, $listPartsInfo->getNextPartNumberMarker());
     $this->assertEquals(1000, $listPartsInfo->getMaxParts());
     $this->assertEquals("false", $listPartsInfo->getIsTruncated());
     $this->assertEquals(3, count($listPartsInfo->getListPart()));
     $this->assertEquals(1, $listPartsInfo->getListPart()[0]->getPartNumber());
     $this->assertEquals('2012-02-23T07:01:34.000Z', $listPartsInfo->getListPart()[0]->getLastModified());
     $this->assertEquals('"3349DC700140D7F86A078484278075A9"', $listPartsInfo->getListPart()[0]->getETag());
     $this->assertEquals(6291456, $listPartsInfo->getListPart()[0]->getSize());
 }
예제 #2
0
 /**
  * 获取已成功上传的part
  *
  * @param string $bucket Bucket名称
  * @param string $object Object名称
  * @param string $uploadId uploadId
  * @param array $options Key-Value数组
  * @return ListPartsInfo
  * @throws OssException
  */
 public function listParts($bucket, $object, $uploadId, $options = null)
 {
     $this->precheckCommon($bucket, $object, $options);
     $options[self::OSS_METHOD] = self::OSS_HTTP_GET;
     $options[self::OSS_BUCKET] = $bucket;
     $options[self::OSS_OBJECT] = $object;
     $options[self::OSS_UPLOAD_ID] = $uploadId;
     $options[self::OSS_QUERY_STRING] = array();
     foreach (array('max-parts', 'part-number-marker') as $param) {
         if (isset($options[$param])) {
             $options[self::OSS_QUERY_STRING][$param] = $options[$param];
             unset($options[$param]);
         }
     }
     $response = $this->auth($options);
     $result = new ListPartsResult($response);
     return $result->getData();
 }