ExiftoolTest.php 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. <?php
  2. /**
  3. * This file is part of the PHPExiftool package.
  4. *
  5. * (c) Alchemy <support@alchemy.fr>
  6. *
  7. * For the full copyright and license information, please view the LICENSE
  8. * file that was distributed with this source code.
  9. */
  10. namespace PHPExiftool\Test;
  11. use Monolog\Logger;
  12. use Monolog\Handler\NullHandler;
  13. use PHPExiftool\Exiftool;
  14. class ExiftoolTest extends \PHPUnit_Framework_TestCase
  15. {
  16. /**
  17. * @covers PHPExiftool\Exiftool::executeCommand
  18. */
  19. public function testExecuteCommand()
  20. {
  21. $exiftool = new Exiftool($this->getlogger());
  22. $this->assertRegExp('/\d+\.\d+/', $exiftool->executeCommand('-ver'));
  23. }
  24. /**
  25. * @covers PHPExiftool\Exiftool::executeCommand
  26. * @covers \PHPExiftool\Exception\RuntimeException
  27. * @expectedException \PHPExiftool\Exception\RuntimeException
  28. */
  29. public function testExecuteCommandFailed()
  30. {
  31. $exiftool = new Exiftool($this->getlogger());
  32. $exiftool->executeCommand('-prout');
  33. }
  34. private function getlogger()
  35. {
  36. $logger = new Logger('Tests');
  37. $logger->pushHandler(new NullHandler());
  38. return $logger;
  39. }
  40. }