FopTest.php 1.2KB

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