CdnManagerTest.php 945 B

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. <?php
  2. /**
  3. * Created by IntelliJ IDEA.
  4. * User: wf
  5. * Date: 2017/6/21
  6. * Time: AM8:46
  7. */
  8. namespace Qiniu\Tests;
  9. use Qiniu\Cdn\CdnManager;
  10. use Qiniu\Http\Client;
  11. class CdnManagerTest extends \PHPUnit_Framework_TestCase
  12. {
  13. protected $cdnManager;
  14. protected $encryptKey;
  15. protected $imgUrl;
  16. protected function setUp()
  17. {
  18. global $timestampAntiLeechEncryptKey;
  19. global $customDomain;
  20. global $testAuth;
  21. $this->cdnManager = new CdnManager($testAuth);
  22. $this->encryptKey = $timestampAntiLeechEncryptKey;
  23. $this->imgUrl = $customDomain . '/24.jpg';
  24. }
  25. public function testCreateTimestampAntiLeechUrl()
  26. {
  27. $signUrl = $this->cdnManager->createTimestampAntiLeechUrl($this->imgUrl, $this->encryptKey, 3600);
  28. $response = Client::get($signUrl);
  29. $this->assertEquals($response->statusCode, 200);
  30. $this->assertNull($response->error);
  31. }
  32. }