QRInterventionImageTest.php 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. <?php
  2. /**
  3. * Class QRInterventionImageTest
  4. *
  5. * @created 04.05.2024
  6. * @author smiley <smiley@chillerlan.net>
  7. * @copyright 2024 smiley
  8. * @license MIT
  9. */
  10. declare(strict_types=1);
  11. namespace chillerlan\QRCodeTest\Output;
  12. use chillerlan\QRCode\QROptions;
  13. use chillerlan\QRCode\Data\QRMatrix;
  14. use chillerlan\QRCode\Output\{QRInterventionImage, QROutputInterface};
  15. use chillerlan\QRCodeTest\Traits\CssColorModuleValueProviderTrait;
  16. use chillerlan\Settings\SettingsContainerInterface;
  17. use Intervention\Image\Interfaces\ImageInterface;
  18. use PHPUnit\Framework\Attributes\{RequiresPhpExtension, Test};
  19. /**
  20. * Tests the QRInterventionImage output class
  21. */
  22. #[RequiresPhpExtension('gd')]
  23. class QRInterventionImageTest extends QROutputTestAbstract{
  24. use CssColorModuleValueProviderTrait;
  25. protected function getOutputInterface(
  26. SettingsContainerInterface|QROptions $options,
  27. QRMatrix $matrix,
  28. ):QROutputInterface{
  29. return new QRInterventionImage($options, $matrix);
  30. }
  31. #[Test]
  32. public function setModuleValues():void{
  33. $this->options->moduleValues = [
  34. // data
  35. QRMatrix::M_DATA_DARK => '#4A6000',
  36. QRMatrix::M_DATA => '#ECF9BE',
  37. ];
  38. $this->outputInterface = $this->getOutputInterface($this->options, $this->matrix);
  39. $this->outputInterface->dump();
  40. /** @phpstan-ignore-next-line */
  41. $this::assertTrue(true); // tricking the code coverage
  42. }
  43. #[Test]
  44. public function outputGetResource():void{
  45. $this->options->returnResource = true;
  46. $this->outputInterface = $this->getOutputInterface($this->options, $this->matrix);
  47. $this::assertInstanceOf(ImageInterface::class, $this->outputInterface->dump());
  48. }
  49. }