PfopTest.php 1.9 KB

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