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/Data/DatainterfaceTestAbstract.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/Data/DatainterfaceTestAbstract.php')
-rw-r--r-- | vendor/chillerlan/php-qrcode/tests/Data/DatainterfaceTestAbstract.php | 65 |
1 files changed, 65 insertions, 0 deletions
diff --git a/vendor/chillerlan/php-qrcode/tests/Data/DatainterfaceTestAbstract.php b/vendor/chillerlan/php-qrcode/tests/Data/DatainterfaceTestAbstract.php new file mode 100644 index 000000000..19d74617a --- /dev/null +++ b/vendor/chillerlan/php-qrcode/tests/Data/DatainterfaceTestAbstract.php @@ -0,0 +1,65 @@ +<?php +/** + * Class DatainterfaceTestAbstract + * + * @filesource DatainterfaceTestAbstract.php + * @created 24.11.2017 + * @package chillerlan\QRCodeTest\Data + * @author Smiley <[email protected]> + * @copyright 2017 Smiley + * @license MIT + */ + +namespace chillerlan\QRCodeTest\Data; + +use chillerlan\QRCode\QROptions; +use chillerlan\QRCode\Data\{QRCodeDataException, QRDataInterface, QRMatrix}; +use chillerlan\QRCodeTest\QRTestAbstract; + +abstract class DatainterfaceTestAbstract extends QRTestAbstract{ + + /** + * @var \chillerlan\QRCode\Data\QRDataAbstract + */ + protected $dataInterface; + + protected $testdata; + protected $expected; + + protected function setUp():void{ + parent::setUp(); + + $this->dataInterface = $this->reflection->newInstanceArgs([new QROptions(['version' => 4])]); + } + + public function testInstance(){ + $this->dataInterface = $this->reflection->newInstanceArgs([new QROptions, $this->testdata]); + + $this->assertInstanceOf(QRDataInterface::class, $this->dataInterface); + } + + public function testSetData(){ + $this->dataInterface->setData($this->testdata); + + $this->assertSame($this->expected, $this->getProperty('matrixdata')->getValue($this->dataInterface)); + } + + public function testInitMatrix(){ + $m = $this->dataInterface->setData($this->testdata)->initMatrix(0); + + $this->assertInstanceOf(QRMatrix::class, $m); + } + + public function testGetMinimumVersion(){ + $this->assertSame(1, $this->getMethod('getMinimumVersion')->invoke($this->dataInterface)); + } + + public function testGetMinimumVersionException(){ + $this->expectException(QRCodeDataException::class); + $this->expectExceptionMessage('data exceeds'); + + $this->getProperty('strlen')->setValue($this->dataInterface, 13370); + $this->getMethod('getMinimumVersion')->invoke($this->dataInterface); + } + +} |