public function testMultipartUploadBigFile() { $bigFileName = __DIR__ . DIRECTORY_SEPARATOR . "/bigfile.tmp"; $localFilename = __DIR__ . DIRECTORY_SEPARATOR . "/localfile.tmp"; OssUtil::generateFile($bigFileName, 6 * 1024 * 1024); $object = 'mpu/multipart-bigfile-test.tmp'; try { $this->ossClient->multiuploadFile($this->bucket, $object, $bigFileName, array(OssClient::OSS_PART_SIZE => 1)); $options = array(OssClient::OSS_FILE_DOWNLOAD => $localFilename); $this->ossClient->getObject($this->bucket, $object, $options); $this->assertEquals(md5_file($bigFileName), md5_file($localFilename)); } catch (OssException $e) { var_dump($e->getMessage()); $this->assertFalse(true); } unlink($bigFileName); unlink($localFilename); }
public function testGenerateFile() { $path = __DIR__ . DIRECTORY_SEPARATOR . "generatedFile.txt"; OssUtil::generateFile($path, 1024 * 1024); $this->assertEquals(filesize($path), 1024 * 1024); unlink($path); }