Skip to content

Commit

Permalink
Merge pull request #21 from aliyun/optimizer
Browse files Browse the repository at this point in the history
php sdk optimizer
  • Loading branch information
qiyuewuyi committed Mar 28, 2016
2 parents 4f6839d + 7470f3e commit 1a046a8
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/OSS/OssClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,10 @@ class OssClient
*/
public function __construct($accessKeyId, $accessKeySecret, $endpoint, $isCName = false, $securityToken = NULL)
{
$accessKeyId = trim($accessKeyId);
$accessKeySecret = trim($accessKeySecret);
$endpoint = trim(trim($endpoint), "/");

if (empty($accessKeyId)) {
throw new OssException("access key id is empty");
}
Expand Down
13 changes: 13 additions & 0 deletions tests/OSS/Tests/OssClientTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -95,4 +95,17 @@ public function testConstrunct8()
}
}

public function testConstrunct9()
{
try {
$accessKeyId = ' ' . getenv('OSS_ACCESS_KEY_ID') . ' ';
$accessKeySecret = ' ' . getenv('OSS_ACCESS_KEY_SECRET') . ' ';
$endpoint = ' ' . getenv('OSS_ENDPOINT') . '/ ';
$ossClient = new OssClient($accessKeyId, $accessKeySecret , $endpoint, false);
$ossClient->listBuckets();
} catch (OssException $e) {
$this->assertFalse(true);
}
}

}

0 comments on commit 1a046a8

Please sign in to comment.