From 3fd785654372d493c031d9b541ab33a881023a32 Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Fri, 26 Feb 2021 19:16:17 +0300 Subject: * switch to composer for qrcode and otp dependencies * move most OTP-related stuff into userhelper * remove old phpqrcode and otphp libraries --- vendor/chillerlan/php-qrcode/tests/QRCodeTest.php | 140 ++++++++++++++++++++++ 1 file changed, 140 insertions(+) create mode 100644 vendor/chillerlan/php-qrcode/tests/QRCodeTest.php (limited to 'vendor/chillerlan/php-qrcode/tests/QRCodeTest.php') diff --git a/vendor/chillerlan/php-qrcode/tests/QRCodeTest.php b/vendor/chillerlan/php-qrcode/tests/QRCodeTest.php new file mode 100644 index 000000000..8613c961f --- /dev/null +++ b/vendor/chillerlan/php-qrcode/tests/QRCodeTest.php @@ -0,0 +1,140 @@ + + * @copyright 2017 Smiley + * @license MIT + */ + +namespace chillerlan\QRCodeTest; + +use chillerlan\QRCode\{QROptions, QRCode}; +use chillerlan\QRCode\Data\{AlphaNum, Byte, Number, QRCodeDataException}; +use chillerlan\QRCode\Output\QRCodeOutputException; +use chillerlan\QRCodeExamples\MyCustomOutput; + +use function random_bytes; + +class QRCodeTest extends QRTestAbstract{ + + protected $FQCN = QRCode::class; + + /** + * @var \chillerlan\QRCode\QRCode + */ + protected $qrcode; + + protected function setUp():void{ + parent::setUp(); + + $this->qrcode = $this->reflection->newInstance(); + } + + public function testIsNumber(){ + $this->assertTrue($this->qrcode->isNumber('0123456789')); + $this->assertFalse($this->qrcode->isNumber('ABC')); + } + + public function testIsAlphaNum(){ + $this->assertTrue($this->qrcode->isAlphaNum('ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890 $%*+-./:')); + $this->assertFalse($this->qrcode->isAlphaNum('abc')); + } + + public function testIsKanji(){ + $this->assertTrue($this->qrcode->isKanji('茗荷')); + $this->assertFalse($this->qrcode->isKanji('Ã')); + } + + // coverage + + public function typeDataProvider(){ + return [ + 'png' => [QRCode::OUTPUT_IMAGE_PNG, 'data:image/png;base64,'], + 'gif' => [QRCode::OUTPUT_IMAGE_GIF, 'data:image/gif;base64,'], + 'jpg' => [QRCode::OUTPUT_IMAGE_JPG, 'data:image/jpg;base64,'], + 'svg' => [QRCode::OUTPUT_MARKUP_SVG, 'data:image/svg+xml;base64,'], + 'html' => [QRCode::OUTPUT_MARKUP_HTML, '