AbstractTestCase.php 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. <?php
  2. namespace Spipu\Html2Pdf\Tests\CrossVersionCompatibility\PhpUnit5;
  3. use Spipu\Html2Pdf\Html2Pdf;
  4. abstract class AbstractTestCase extends \PHPUnit_Framework_TestCase
  5. {
  6. /**
  7. * @var Html2Pdf
  8. */
  9. protected $html2pdf;
  10. /**
  11. * Executed before each test
  12. */
  13. protected function setUp()
  14. {
  15. $this->html2pdf = new Html2Pdf('P', 'A4', 'fr', true, 'UTF-8', [0, 0, 0, 0]);
  16. $this->html2pdf->pdf->SetTitle('PhpUnit Test');
  17. }
  18. /**
  19. * Executed after each test
  20. */
  21. protected function tearDown()
  22. {
  23. $this->html2pdf->clean();
  24. $this->html2pdf = null;
  25. }
  26. public function expectException($exception)
  27. {
  28. if (method_exists(\PHPUnit_Framework_TestCase::class, 'setExpectedException')) {
  29. $this->setExpectedException($exception);
  30. }
  31. }
  32. public function expectExceptionMessage($message, $exception = null)
  33. {
  34. if (method_exists(\PHPUnit_Framework_TestCase::class, 'expectExceptionMessage')) {
  35. parent::expectExceptionMessage($message);
  36. } elseif (method_exists(\PHPUnit_Framework_TestCase::class, 'setExpectedException')) {
  37. $this->setExpectedException($exception, $message);
  38. }
  39. }
  40. }