LongSentenceExceptionTest.php 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. <?php
  2. /**
  3. * Html2Pdf Library - Tests
  4. *
  5. * HTML => PDF converter
  6. * distributed under the OSL-3.0 License
  7. *
  8. * @package Html2pdf
  9. * @author Laurent MINGUET <webmaster@html2pdf.fr>
  10. * @copyright 2023 Laurent MINGUET
  11. */
  12. namespace Spipu\Html2Pdf\Tests\Exception;
  13. use Spipu\Html2Pdf\Exception\LongSentenceException;
  14. use Spipu\Html2Pdf\Tests\AbstractTest;
  15. /**
  16. * Class DebugTest
  17. */
  18. class LongSentenceExceptionTest extends AbstractTest
  19. {
  20. /**
  21. * test LongSentence Exception
  22. *
  23. * @return void
  24. */
  25. public function testBug()
  26. {
  27. $this->expectException(LongSentenceException::class);
  28. $sentence = 'This is a sentence.';
  29. $bigSentence = $sentence;
  30. for ($k=0; $k<110; $k++) {
  31. $bigSentence.= ' '.$sentence;
  32. }
  33. $html = '<page backleft="0" backright="200mm"style="font-size: 1mm">'.$bigSentence.'</page>';
  34. $object = $this->getObject();
  35. $object->setSentenceMaxLines(100);
  36. $object->writeHTML($html);
  37. $object->output('test.pdf', 'S');
  38. }
  39. }