Skip to content

Commit e9a7381

Browse files
committed
testSetKeys
1 parent 5bcbe47 commit e9a7381

File tree

3 files changed

+18
-3
lines changed

3 files changed

+18
-3
lines changed

.travis.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@ php:
33
- 5.2
44
- 5.3
55
- 5.4
6+
before_script:
7+
- export QINIU_ACCESS_KEY="iN7NgwM31j4-BZacMjPrOQBs34UG1maYCAQmhdCV"
8+
- export QINIU_SECRET_KEY="6QTOr2Jg1gcZEWDQXKOGZh5PziC2MCV5KsntT70j"
69
script:
710
- cd tests; phpunit .
811

tests/AuthDigestTest.php

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,15 @@ public function testEncode()
1818

1919
public function testSetKeys()
2020
{
21-
Qiniu_SetKeys("abc", "def");
2221
$mac = Qiniu_RequireMac(null);
23-
$this->assertEquals($mac->AccessKey, "abc");
24-
$this->assertEquals($mac->SecretKey, "def");
22+
$this->assertTrue(!empty($mac->AccessKey) && !empty($mac->SecretKey), 'please provide keys');
23+
24+
Qiniu_SetKeys('abc', 'def');
25+
$mac = Qiniu_RequireMac(null);
26+
$this->assertEquals($mac->AccessKey, 'abc');
27+
$this->assertEquals($mac->SecretKey, 'def');
28+
29+
Qiniu_SetKeys($mac->AccessKey, $mac->SecretKey);
2530
}
2631
}
2732

tests/bootstrap.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,10 @@
22

33
require_once("../qiniu/rs.php");
44

5+
$accessKey = getenv("QINIU_ACCESS_KEY");
6+
$secretKey = getenv("QINIU_SECRET_KEY");
7+
8+
if (!empty($accessKey) && !empty($secretKey)) {
9+
Qiniu_SetKeys($accessKey, $secretKey);
10+
}
11+

0 commit comments

Comments
 (0)