diff --git a/src/BucketClient.php b/src/BucketClient.php index a3ee8a4..2f6aa60 100644 --- a/src/BucketClient.php +++ b/src/BucketClient.php @@ -22,6 +22,8 @@ public function __construct($config) throw new InvalidConfigException('No bucket configured.'); } + parent::__construct($config); + $this->setBaseUri(\sprintf( 'https://%s-%s.cos.%s.myqcloud.com/', $config->get('bucket'), diff --git a/src/JobClient.php b/src/JobClient.php index 1ce3937..9d3796f 100644 --- a/src/JobClient.php +++ b/src/JobClient.php @@ -20,6 +20,8 @@ public function __construct($config) $this->validateConfig($config); + parent::__construct($config); + $this->setBaseUri(\sprintf( 'https://%s.cos-control.%s.myqcloud.com/', $config->get('uin'), diff --git a/src/ObjectClient.php b/src/ObjectClient.php index d9793b3..aa822e0 100644 --- a/src/ObjectClient.php +++ b/src/ObjectClient.php @@ -27,6 +27,8 @@ public function __construct($config) throw new InvalidConfigException('No bucket configured.'); } + parent::__construct($config); + $this->setBaseUri(\sprintf( 'https://%s-%s.cos.%s.myqcloud.com/', $config->get('bucket'), diff --git a/tests/BucketClientTest.php b/tests/BucketClientTest.php index 7f0a4aa..9d4791b 100644 --- a/tests/BucketClientTest.php +++ b/tests/BucketClientTest.php @@ -14,6 +14,8 @@ public function testBaseUri() 'bucket' => 'test', 'app_id' => '123456', 'region' => 'ap-guangzhou', + 'secret_id' => 'test', + 'secret_key' => 'test', ]); $this->assertSame('https://test-123456.cos.ap-guangzhou.myqcloud.com/', $bucketClient->getBaseUri()); diff --git a/tests/JobClientTest.php b/tests/JobClientTest.php index aa3a24a..8f29171 100644 --- a/tests/JobClientTest.php +++ b/tests/JobClientTest.php @@ -14,6 +14,8 @@ public function testBaseUri() 'app_id' => 1250000000, 'uin' => 1000000000, 'region' => 'ap-guangzhou', + 'secret_id' => 'test', + 'secret_key' => 'test', ]); $this->assertSame('https://1000000000.cos-control.ap-guangzhou.myqcloud.com/', $client->getBaseUri()); diff --git a/tests/ObjectClientTest.php b/tests/ObjectClientTest.php index fb4dd3a..bf366e6 100644 --- a/tests/ObjectClientTest.php +++ b/tests/ObjectClientTest.php @@ -15,6 +15,8 @@ public function testBaseUri() $client = new ObjectClient([ 'bucket' => 'test', 'app_id' => '123456', + 'secret_id' => 'test', + 'secret_key' => 'test', ]); $this->assertSame('https://test-123456.cos.ap-guangzhou.myqcloud.com/', $client->getBaseUri());