OutputFileTest.php 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. <?php namespace thiagoalessio\TesseractOCR\Tests\Unit;
  2. use thiagoalessio\TesseractOCR\Tests\Common\TestCase;
  3. use thiagoalessio\TesseractOCR\Command;
  4. class OutputFileTest extends TestCase
  5. {
  6. public function beforeEach()
  7. {
  8. $this->cmd = new Command('image', '/path/to/output/file');
  9. }
  10. public function testTxt()
  11. {
  12. foreach (array('digits', 'quiet', 'txt', 'anything', 'else') as $ext) {
  13. $this->cmd->configFile = $ext;
  14. $expected = "/path/to/output/file.txt";
  15. $this->assertEquals($expected, $this->cmd->getOutputFile());
  16. }
  17. }
  18. public function testHocr()
  19. {
  20. $this->cmd->configFile = 'hocr';
  21. $expected = '/path/to/output/file.hocr';
  22. $this->assertEquals($expected, $this->cmd->getOutputFile());
  23. }
  24. public function testTsv()
  25. {
  26. $this->cmd->configFile = 'tsv';
  27. $expected = '/path/to/output/file.tsv';
  28. $this->assertEquals($expected, $this->cmd->getOutputFile());
  29. }
  30. public function testPdf()
  31. {
  32. $this->cmd->configFile = 'pdf';
  33. $expected = '/path/to/output/file.pdf';
  34. $this->assertEquals($expected, $this->cmd->getOutputFile());
  35. }
  36. }