diff options
author | Andrew Dolgov <[email protected]> | 2021-02-26 19:16:17 +0300 |
---|---|---|
committer | Andrew Dolgov <[email protected]> | 2021-02-26 19:16:17 +0300 |
commit | 3fd785654372d493c031d9b541ab33a881023a32 (patch) | |
tree | 0a76cb410217074378de3d7012b95754cd3c7e6f /vendor/chillerlan/php-qrcode/tests/Output/QRImageTest.php | |
parent | bc4475b6698f5a74e475674aa7af43253c459892 (diff) |
* switch to composer for qrcode and otp dependencies
* move most OTP-related stuff into userhelper
* remove old phpqrcode and otphp libraries
Diffstat (limited to 'vendor/chillerlan/php-qrcode/tests/Output/QRImageTest.php')
-rw-r--r-- | vendor/chillerlan/php-qrcode/tests/Output/QRImageTest.php | 69 |
1 files changed, 69 insertions, 0 deletions
diff --git a/vendor/chillerlan/php-qrcode/tests/Output/QRImageTest.php b/vendor/chillerlan/php-qrcode/tests/Output/QRImageTest.php new file mode 100644 index 000000000..34ecf4f91 --- /dev/null +++ b/vendor/chillerlan/php-qrcode/tests/Output/QRImageTest.php @@ -0,0 +1,69 @@ +<?php +/** + * Class QRImageTest + * + * @filesource QRImageTest.php + * @created 24.12.2017 + * @package chillerlan\QRCodeTest\Output + * @author Smiley <[email protected]> + * @copyright 2017 Smiley + * @license MIT + */ + +namespace chillerlan\QRCodeTest\Output; + +use chillerlan\QRCode\{QRCode, Output\QRImage}; + +class QRImageTest extends QROutputTestAbstract{ + + protected $FQCN = QRImage::class; + + public function types(){ + return [ + 'png' => [QRCode::OUTPUT_IMAGE_PNG], + 'gif' => [QRCode::OUTPUT_IMAGE_GIF], + 'jpg' => [QRCode::OUTPUT_IMAGE_JPG], + ]; + } + + /** + * @dataProvider types + * @param $type + */ + public function testImageOutput($type){ + $this->options->outputType = $type; + $this->options->imageBase64 = false; + + $this->setOutputInterface(); + $this->outputInterface->dump($this::cachefile.$type); + $img = $this->outputInterface->dump(); + + if($type === QRCode::OUTPUT_IMAGE_JPG){ // jpeg encoding may cause different results + $this->markAsRisky(); + } + + $this->assertSame($img, file_get_contents($this::cachefile.$type)); + } + + public function testSetModuleValues(){ + + $this->options->moduleValues = [ + // data + 1024 => [0, 0, 0], + 4 => [255, 255, 255], + ]; + + $this->setOutputInterface()->dump(); + + $this->assertTrue(true); // tricking the code coverage + } + + public function testOutputGetResource():void{ + $this->options->returnResource = true; + + $this->setOutputInterface(); + + $this::assertIsResource($this->outputInterface->dump()); + } + +} |