Skip to content

Commit e35572d

Browse files
committed
add part of the test
1 parent 57cd237 commit e35572d

File tree

2 files changed

+54
-0
lines changed

2 files changed

+54
-0
lines changed

tests/Qiniu/Tests/ZoneTest.php

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
<?php
2+
namespace Qiniu\Tests;
3+
4+
use Qiniu;
5+
use Qiniu\Zone;
6+
7+
class ZoneTest extends \PHPUnit_Framework_TestCase
8+
{
9+
protected $zone;
10+
protected $zoneHttps;
11+
protected $ak;
12+
13+
protected $bucketName;
14+
protected $bucketNameBC;
15+
16+
17+
protected function setUp()
18+
{
19+
global $bucketName;
20+
$this->bucketName = $bucketName;
21+
22+
global $bucketNameBC;
23+
$this->bucketNameBC = $bucketNameBC;
24+
25+
global $accessKey;
26+
$this->ak = $accessKey;
27+
28+
$this->zone = new Zone();
29+
$this->zoneHttps = new Zone('https');
30+
}
31+
32+
public function testUpHosts()
33+
{
34+
35+
list($upHosts, $err) = $this->zone->getUpHosts($this->ak, $this->bucketName);
36+
$this->assertNull($err);
37+
$this->assertEquals('http://up.qiniu.com', $upHosts[0]);
38+
$this->assertEquals('http://upload.qiniu.com', $upHosts[1]);
39+
40+
list($upHosts, $err) = $this->zone->getUpHosts($this->ak, $this->bucketNameBC);
41+
$this->assertNull($err);
42+
$this->assertEquals('http://up-z1.qiniu.com', $upHosts[0]);
43+
$this->assertEquals('http://upload-z1.qiniu.com', $upHosts[1]);
44+
45+
list($upHosts, $err) = $this->zoneHttps->getUpHosts($this->ak, $this->bucketName);
46+
$this->assertNull($err);
47+
$this->assertEquals('https://up.qbox.me', $upHosts[0]);
48+
49+
list($upHosts, $err) = $this->zoneHttps->getUpHosts($this->ak, $this->bucketNameBC);
50+
$this->assertNull($err);
51+
$this->assertEquals('https://up-z1.qbox.me', $upHosts[0]);
52+
}
53+
}

tests/bootstrap.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
$testAuth = new Auth($accessKey, $secretKey);
1010
$bucketName = 'phpsdk';
1111
$key = 'php-logo.png';
12+
$bucketNameBC = 'phpsdk-bc';
1213

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

0 commit comments

Comments
 (0)