Skip to content

Commit d46b2d2

Browse files
committed
add na test case
1 parent e9373fc commit d46b2d2

File tree

3 files changed

+31
-2
lines changed

3 files changed

+31
-2
lines changed

src/Qiniu/Zone.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,15 +28,13 @@ public function __construct($scheme = null)
2828
public function getUpHostByToken($uptoken)
2929
{
3030
list($ak, $bucket) = $this->unmarshalUpToken($uptoken);
31-
// sssssssssssssssssssssssssss
3231
list($upHosts, $err) = $this->getUpHosts($ak, $bucket);
3332
return array($upHosts[0], $err);
3433
}
3534

3635
public function getBackupUpHostByToken($uptoken)
3736
{
3837
list($ak, $bucket) = $this->unmarshalUpToken($uptoken);
39-
// sssssssssssssssssssssssssss
4038
list($upHosts, $err) = $this->getUpHosts($ak, $bucket);
4139

4240
$upHost = isset($upHosts[1]) ? $upHosts[1] : $upHosts[0];

tests/Qiniu/Tests/ZoneTest.php

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ class ZoneTest extends \PHPUnit_Framework_TestCase
1212

1313
protected $bucketName;
1414
protected $bucketNameBC;
15+
protected $bucketNameNA;
1516

1617

1718
protected function setUp()
@@ -22,6 +23,9 @@ protected function setUp()
2223
global $bucketNameBC;
2324
$this->bucketNameBC = $bucketNameBC;
2425

26+
global $bucketNameNA;
27+
$this->bucketNameNA = $bucketNameNA;
28+
2529
global $accessKey;
2630
$this->ak = $accessKey;
2731

@@ -32,23 +36,37 @@ protected function setUp()
3236
public function testUpHosts()
3337
{
3438

39+
// test nb http
3540
list($upHosts, $err) = $this->zone->getUpHosts($this->ak, $this->bucketName);
3641
$this->assertNull($err);
3742
$this->assertEquals('http://up.qiniu.com', $upHosts[0]);
3843
$this->assertEquals('http://upload.qiniu.com', $upHosts[1]);
3944

45+
// test bc http
4046
list($upHosts, $err) = $this->zone->getUpHosts($this->ak, $this->bucketNameBC);
4147
$this->assertNull($err);
4248
$this->assertEquals('http://up-z1.qiniu.com', $upHosts[0]);
4349
$this->assertEquals('http://upload-z1.qiniu.com', $upHosts[1]);
4450

51+
// test na http
52+
list($upHosts, $err) = $this->zone->getUpHosts($this->ak, $this->bucketNameNA);
53+
$this->assertNull($err);
54+
$this->assertEquals('http://up-na0.qiniu.com', $upHosts[0]);
55+
56+
// test nb https
4557
list($upHosts, $err) = $this->zoneHttps->getUpHosts($this->ak, $this->bucketName);
4658
$this->assertNull($err);
4759
$this->assertEquals('https://up.qbox.me', $upHosts[0]);
4860

61+
// test bc https
4962
list($upHosts, $err) = $this->zoneHttps->getUpHosts($this->ak, $this->bucketNameBC);
5063
$this->assertNull($err);
5164
$this->assertEquals('https://up-z1.qbox.me', $upHosts[0]);
65+
66+
// test na https
67+
list($upHosts, $err) = $this->zoneHttps->getUpHosts($this->ak, $this->bucketNameNA);
68+
$this->assertNull($err);
69+
$this->assertEquals('https://up-na0.qbox.me', $upHosts[0]);
5270
}
5371

5472
public function testUpHostByToken()
@@ -82,16 +100,28 @@ public function testUpHostByToken()
82100
public function testIoHosts()
83101
{
84102

103+
// test nb http
85104
$ioHost = $this->zone->getIoHost($this->ak, $this->bucketName);
86105
$this->assertEquals('http://iovip.qbox.me', $ioHost);
87106

107+
// test bc http
88108
$ioHost = $this->zone->getIoHost($this->ak, $this->bucketNameBC);
89109
$this->assertEquals('http://iovip-z1.qbox.me', $ioHost);
90110

111+
// test na http
112+
$ioHost = $this->zone->getIoHost($this->ak, $this->bucketNameNA);
113+
$this->assertEquals('http://iovip-na0.qbox.me', $ioHost);
114+
115+
// test nb https
91116
$ioHost = $this->zoneHttps->getIoHost($this->ak, $this->bucketName);
92117
$this->assertEquals('https://iovip.qbox.me', $ioHost);
93118

119+
// test bc https
94120
$ioHost = $this->zoneHttps->getIoHost($this->ak, $this->bucketNameBC);
95121
$this->assertEquals('https://iovip-z1.qbox.me', $ioHost);
122+
123+
// test na https
124+
$ioHost = $this->zoneHttps->getIoHost($this->ak, $this->bucketNameNA);
125+
$this->assertEquals('https://iovip-na0.qbox.me', $ioHost);
96126
}
97127
}

tests/bootstrap.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
$bucketName = 'phpsdk';
1111
$key = 'php-logo.png';
1212
$bucketNameBC = 'phpsdk-bc';
13+
$bucketNameNA = 'phpsdk-na';
1314

1415
$dummyAccessKey = 'abcdefghklmnopq';
1516
$dummySecretKey = '1234567890';

0 commit comments

Comments
 (0)