getOssClient() public static method

根据Config配置,得到一个OssClient实例
public static getOssClient ( ) : OssClient
return OSS\OssClient 一个OssClient实例
コード例 #1
0
 public function setUp()
 {
     $this->client = Common::getOssClient();
     $this->bucketName = 'php-sdk-test-rtmp-bucket-name-' . strval(rand(0, 10000));
     $this->client->createBucket($this->bucketName);
     Common::waitMetaSync();
 }
コード例 #2
0
 public function setUp()
 {
     $this->bucket = Common::getBucketName() . rand(100000, 999999);
     $this->ossClient = Common::getOssClient();
     $this->ossClient->createBucket($this->bucket);
     Common::waitMetaSync();
 }
コード例 #3
0
 public function setUp()
 {
     $this->client = Common::getOssClient();
     $this->bucketName = 'php-sdk-test-bucket-image-' . strval(rand(0, 10000));
     $this->client->createBucket($this->bucketName);
     Common::waitMetaSync();
     $this->local_file = "example.jpg";
     $this->object = "oss-example.jpg";
     $this->download_file = "image.jpg";
     $this->client->uploadFile($this->bucketName, $this->object, $this->local_file);
 }
コード例 #4
0
 public function testGetSet()
 {
     $client = Common::getOssClient();
     $bucket = Common::getBucketName();
     $object = 'test/object-acl';
     $client->deleteObject($bucket, $object);
     $client->putObject($bucket, $object, "hello world");
     $acl = $client->getObjectAcl($bucket, $object);
     $this->assertEquals('default', $acl);
     $client->putObjectAcl($bucket, $object, 'public-read');
     $acl = $client->getObjectAcl($bucket, $object);
     $this->assertEquals('public-read', $acl);
     $content = $client->getObject($bucket, $object);
     $this->assertEquals('hello world', $content);
 }
コード例 #5
0
ファイル: ContentTypeTest.php プロジェクト: waqt/kdweb
 public function testByUser()
 {
     $client = Common::getOssClient();
     $bucket = Common::getBucketName();
     $object = "test/x.txt";
     $client->putObject($bucket, $object, "hello world", array('Content-Type' => 'text/html'));
     $type = $this->getContentType($bucket, $object);
     $this->assertEquals('text/html', $type);
     $file = '/tmp/x.html';
     $object = 'test/x';
     $this->runCmd('touch ' . $file);
     $client->uploadFile($bucket, $object, $file, array('Content-Type' => 'application/json'));
     $type = $this->getContentType($bucket, $object);
     $this->assertEquals('application/json', $type);
     $file = '/tmp/x.json';
     $object = 'test/y';
     $this->runCmd('dd if=/dev/random of=' . $file . ' bs=1024 count=100');
     $client->multiuploadFile($bucket, $object, $file, array('partSize' => 100, 'Content-Type' => 'audio/mpeg'));
     $type = $this->getContentType($bucket, $object);
     $this->assertEquals('audio/mpeg', $type);
 }
コード例 #6
0
ファイル: BucketCnameTest.php プロジェクト: waqt/kdweb
 public function setUp()
 {
     $this->client = Common::getOssClient();
     $this->bucketName = 'php-sdk-test-bucket-' . strval(rand(0, 10));
     $this->client->createBucket($this->bucketName);
 }
コード例 #7
0
 public function setUp()
 {
     $this->bucket = Common::getBucketName();
     $this->ossClient = Common::getOssClient();
     $this->ossClient->createBucket($this->bucket);
 }