ZoneTest.php 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. <?php
  2. namespace Qiniu\Tests;
  3. use Qiniu;
  4. use Qiniu\Zone;
  5. class ZoneTest extends \PHPUnit_Framework_TestCase
  6. {
  7. protected $zone;
  8. protected $zoneHttps;
  9. protected $ak;
  10. protected $bucketName;
  11. protected $bucketNameBC;
  12. protected $bucketNameNA;
  13. protected function setUp()
  14. {
  15. global $bucketName;
  16. $this->bucketName = $bucketName;
  17. global $bucketNameBC;
  18. $this->bucketNameBC = $bucketNameBC;
  19. global $bucketNameNA;
  20. $this->bucketNameNA = $bucketNameNA;
  21. global $accessKey;
  22. $this->ak = $accessKey;
  23. $this->zone = new Zone();
  24. $this->zoneHttps = new Zone('https');
  25. }
  26. public function testUpHosts()
  27. {
  28. $zone = Zone::queryZone($this->ak, $this->bucketName);
  29. $this->assertContains('upload.qiniup.com', $zone->cdnUpHosts);
  30. $zone = Zone::queryZone($this->ak, $this->bucketNameBC);
  31. $this->assertContains('upload-z1.qiniup.com', $zone->cdnUpHosts);
  32. $zone = Zone::queryZone($this->ak, $this->bucketNameNA);
  33. $this->assertContains('upload-na0.qiniup.com', $zone->cdnUpHosts);
  34. }
  35. public function testIoHosts()
  36. {
  37. $zone = Zone::queryZone($this->ak, $this->bucketName);
  38. $this->assertEquals($zone->iovipHost, 'iovip.qbox.me');
  39. $zone = Zone::queryZone($this->ak, $this->bucketNameBC);
  40. $this->assertEquals($zone->iovipHost, 'iovip-z1.qbox.me');
  41. $zone = Zone::queryZone($this->ak, $this->bucketNameNA);
  42. $this->assertEquals($zone->iovipHost, 'iovip-na0.qbox.me');
  43. }
  44. }