OutputTestAbstract.php 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. <?php
  2. /**
  3. *
  4. * @filesource OutputTestAbstract.php
  5. * @created 17.12.2016
  6. * @package chillerlan\QRCodeTest\Output
  7. * @author Smiley <smiley@chillerlan.net>
  8. * @copyright 2016 Smiley
  9. * @license MIT
  10. */
  11. namespace chillerlan\QRCodeTest\Output;
  12. /**
  13. * Class OutputTestAbstract
  14. */
  15. abstract class OutputTestAbstract extends \PHPUnit_Framework_TestCase{
  16. protected $outputInterfaceClass;
  17. protected $outputOptionsClass;
  18. protected $options;
  19. protected $outputInterface;
  20. protected function setUp(){
  21. $this->options = new $this->outputOptionsClass;
  22. $this->outputInterface = new $this->outputInterfaceClass($this->options);
  23. }
  24. public function testInstance(){
  25. $this->assertInstanceOf($this->outputInterfaceClass, $this->outputInterface);
  26. $this->assertInstanceOf($this->outputOptionsClass, $this->options);
  27. }
  28. /**
  29. * @expectedException \chillerlan\QRCode\Output\QRCodeOutputException
  30. * @expectedExceptionMessage Invalid output type!
  31. */
  32. public function testOutputTypeException(){
  33. $this->options->type = 'foo';
  34. new $this->outputInterfaceClass($this->options);
  35. }
  36. /**
  37. * @expectedException \chillerlan\QRCode\Output\QRCodeOutputException
  38. * @expectedExceptionMessage Invalid matrix!
  39. */
  40. public function testSetMatrixException(){
  41. /** @var \chillerlan\QRCode\Output\QROutputInterface $outputInterface */
  42. $outputInterface = new $this->outputInterfaceClass;
  43. $outputInterface->setMatrix([]);
  44. }
  45. }