OfficeConverterTest.php 967 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. <?php
  2. /**
  3. * office-converter
  4. *
  5. * Author: Chukwuemeka Nwobodo (jcnwobodo@gmail.com)
  6. * Date: 11/13/2016
  7. * Time: 12:49 AM
  8. **/
  9. use NcJoes\OfficeConverter\OfficeConverter;
  10. use PHPUnit\Framework\TestCase;
  11. class OfficeConverterTest extends TestCase
  12. {
  13. /**
  14. * @var OfficeConverter $converter
  15. */
  16. private $converter;
  17. private $outDir;
  18. public function setUp()
  19. {
  20. parent::setUp();
  21. $DS = DIRECTORY_SEPARATOR;
  22. $file = __DIR__."{$DS}sources{$DS}test1.docx";
  23. $this->outDir = __DIR__."{$DS}results";
  24. $this->converter = new OfficeConverter($file, $this->outDir);
  25. }
  26. public function testDocxToPdfConversion()
  27. {
  28. $output = $this->converter->convertTo('result1.pdf');
  29. $this->assertFileExists($output);
  30. }
  31. public function testDocxToHtmlConversion()
  32. {
  33. $output = $this->converter->convertTo('result1.html');
  34. $this->assertFileExists($output);
  35. }
  36. }