FopTest.php 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. <?php
  2. namespace Qiniu\Tests;
  3. use PHPUnit\Framework\TestCase;
  4. use Qiniu\Processing\Operation;
  5. use Qiniu\Processing\PersistentFop;
  6. class FopTest extends TestCase
  7. {
  8. public function testExifPub()
  9. {
  10. $fop = new Operation('sdk.peterpy.cn');
  11. list($exif, $error) = $fop->execute('gogopher.jpg', 'exif');
  12. $this->assertNull($error);
  13. $this->assertNotNull($exif);
  14. }
  15. public function testExifPrivate()
  16. {
  17. global $testAuth;
  18. $fop = new Operation('private-res.qiniudn.com', $testAuth);
  19. list($exif, $error) = $fop->execute('noexif.jpg', 'exif');
  20. $this->assertNotNull($error);
  21. $this->assertNull($exif);
  22. }
  23. public function testbuildUrl()
  24. {
  25. $fops = 'imageView2/2/h/200';
  26. $fop = new Operation('testres.qiniudn.com');
  27. $url = $fop->buildUrl('gogopher.jpg', $fops);
  28. $this->assertEquals($url, 'http://testres.qiniudn.com/gogopher.jpg?imageView2/2/h/200');
  29. $fops = array('imageView2/2/h/200', 'imageInfo');
  30. $url = $fop->buildUrl('gogopher.jpg', $fops);
  31. $this->assertEquals($url, 'http://testres.qiniudn.com/gogopher.jpg?imageView2/2/h/200|imageInfo');
  32. }
  33. }