No Description

PfopTest.php 1.9KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. <?php
  2. namespace Qiniu\Tests;
  3. use Qiniu\Processing\Operation;
  4. use Qiniu\Processing\PersistentFop;
  5. class PfopTest extends \PHPUnit_Framework_TestCase
  6. {
  7. public function testPfop()
  8. {
  9. global $testAuth;
  10. $bucket = 'testres';
  11. $key = 'sintel_trailer.mp4';
  12. $pfop = new PersistentFop($testAuth, null);
  13. $fops = 'avthumb/m3u8/segtime/10/vcodec/libx264/s/320x240';
  14. list($id, $error) = $pfop->execute($bucket, $key, $fops);
  15. $this->assertNull($error);
  16. list($status, $error) = $pfop->status($id);
  17. $this->assertNotNull($status);
  18. $this->assertNull($error);
  19. }
  20. public function testPfops()
  21. {
  22. global $testAuth;
  23. $bucket = 'testres';
  24. $key = 'sintel_trailer.mp4';
  25. $fops = array(
  26. 'avthumb/m3u8/segtime/10/vcodec/libx264/s/320x240',
  27. 'vframe/jpg/offset/7/w/480/h/360',
  28. );
  29. $pfop = new PersistentFop($testAuth, null);
  30. list($id, $error) = $pfop->execute($bucket, $key, $fops);
  31. $this->assertNull($error);
  32. list($status, $error) = $pfop->status($id);
  33. $this->assertNotNull($status);
  34. $this->assertNull($error);
  35. }
  36. public function testMkzip()
  37. {
  38. global $testAuth;
  39. $bucket = 'phpsdk';
  40. $key = 'php-logo.png';
  41. $pfop = new PersistentFop($testAuth, null);
  42. $url1 = 'http://phpsdk.qiniudn.com/php-logo.png';
  43. $url2 = 'http://phpsdk.qiniudn.com/php-sdk.html';
  44. $zipKey = 'test.zip';
  45. $fops = 'mkzip/2/url/' . \Qiniu\base64_urlSafeEncode($url1);
  46. $fops .= '/url/' . \Qiniu\base64_urlSafeEncode($url2);
  47. $fops .= '|saveas/' . \Qiniu\base64_urlSafeEncode("$bucket:$zipKey");
  48. list($id, $error) = $pfop->execute($bucket, $key, $fops);
  49. $this->assertNull($error);
  50. list($status, $error) = $pfop->status($id);
  51. $this->assertNotNull($status);
  52. $this->assertNull($error);
  53. }
  54. }