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/QROutputTestAbstract.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/QROutputTestAbstract.php')
-rw-r--r-- | vendor/chillerlan/php-qrcode/tests/Output/QROutputTestAbstract.php | 71 |
1 files changed, 71 insertions, 0 deletions
diff --git a/vendor/chillerlan/php-qrcode/tests/Output/QROutputTestAbstract.php b/vendor/chillerlan/php-qrcode/tests/Output/QROutputTestAbstract.php new file mode 100644 index 000000000..6cd95d080 --- /dev/null +++ b/vendor/chillerlan/php-qrcode/tests/Output/QROutputTestAbstract.php @@ -0,0 +1,71 @@ +<?php +/** + * Class QROutputTestAbstract + * + * @filesource QROutputTestAbstract.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\QROptions; +use chillerlan\QRCode\Data\Byte; +use chillerlan\QRCode\Output\{QRCodeOutputException, QROutputInterface}; +use chillerlan\QRCodeTest\QRTestAbstract; + +use function dirname, file_exists, mkdir; + +abstract class QROutputTestAbstract extends QRTestAbstract{ + + const cachefile = __DIR__.'/../../.build/output_test/test.'; + + /** + * @var \chillerlan\QRCode\Output\QROutputInterface + */ + protected $outputInterface; + + /** + * @var \chillerlan\QRCode\QROptions + */ + protected $options; + + /** + * @var \chillerlan\QRCode\Data\QRMatrix + */ + protected $matrix; + + protected function setUp():void{ + parent::setUp(); + + $buildDir = dirname($this::cachefile); + if(!file_exists($buildDir)){ + mkdir($buildDir, 0777, true); + } + + $this->options = new QROptions; + $this->setOutputInterface(); + } + + protected function setOutputInterface(){ + $this->outputInterface = $this->reflection->newInstanceArgs([$this->options, (new Byte($this->options, 'testdata'))->initMatrix(0)]); + return $this->outputInterface; + } + + public function testInstance(){ + $this->assertInstanceOf(QROutputInterface::class, $this->outputInterface); + } + + public function testSaveException(){ + $this->expectException(QRCodeOutputException::class); + $this->expectExceptionMessage('Could not write data to cache file: /foo'); + + $this->options->cachefile = '/foo'; + $this->setOutputInterface(); + $this->outputInterface->dump(); + } + +} |